[Bug c++/38377] __builtin_constant_p(t) ? t : 1 is not considered a constant integer expression
vincent-gcc at vinc17 dot net
gcc-bugzilla@gcc.gnu.org
Tue Nov 29 15:37:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38377
--- Comment #11 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Ditto in C with _Static_assert, as soon as optimizations are enabled:
void f (void)
{
int t = 1;
_Static_assert (__builtin_constant_p (t) ? t : 1, "err");
}
$ gcc-6 -c fail.c
$ gcc-6 -c fail.c -O
fail.c: In function ‘f’:
fail.c:4:48: error: expression in static assertion is not constant
_Static_assert (__builtin_constant_p (t) ? t : 1, "err");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
More information about the Gcc-bugs
mailing list