On 2016-02-24, Mike Miller <[email protected]> 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

_______________________________________________
Autoconf mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to