autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C11 and C++11 support detection fails with clang


From: Nick Bowler
Subject: Re: C11 and C++11 support detection fails with clang
Date: Wed, 24 Feb 2016 13:51:07 -0500

On 2016-02-24, Mike Miller <address@hidden> wrote:
[...]
> The C11 feature tests fail with the following:
>
>   conftest.c:191:19: error: static_assert expression is not an integral
> constant expression
>     _Static_assert (&v1.i == &v1.w.k, "Anonymous union alignment botch");
>
> This seems like a valid diagnostic if I'm reading the standard right,
> even though gcc permits it. I'm not sure what can replace it, but simply
> removing the assertion allows the rest of the test to pass. Any other
> ideas?

Right, the C11 standard says that the controlling expression of
_Static_assert must be an integer constant expression.  The expression
above contains address constants that are evaluated, so it is not an
integer constant expression.

The test could be rewritten using offsetof (untested):

  _Static_assert(offsetof(struct anonymous, i)
                   == offsetof(struct anonymous, w.k),
                 "Anonymous union alignment botch");

Cheers,
  Nick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]