[cfe-dev] Is this a bug? _Static_assert() failed although __has_feature(c_static_assert) is false

Gao, Yunzhong yunzhong_gao at playstation.sony.com
Fri Jul 19 16:18:02 PDT 2013


Hi,
When compiling the following test program on my Ubuntu machine, I get a compile-time error:

/* test.c */
#if __has_feature(c_static_assert)
#pragma message("HAS_STATIC_ASSERT")
#else
_Static_assert(1==0,"");  // if there is no static assert support
#endif
/* end of test.c */

$ install/bin/clang -S -o - test.c
test.c:4:1: error: static_assert failed ""
_Static_assert(1==0,"");
^              ~~~~
1 error generated.

Since __has_feature(c_static_assert) is false, I would not expect _Static_assert() to be enabled here. Should I file a clang bug?

Thanks,
- Gao.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130719/a00c1a1f/attachment.html>


More information about the cfe-dev mailing list