[Bug 276738] clang: static_assert conflicts with -std=c++98 -pedantic-errors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 31 Jan 2024 08:56:22 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276738
--- Comment #3 from Henri Menke <henri@henrimenke.de> ---
I have narrowed this down a bit more. The following code doesn't preprocess
correctly
#include <cassert>
//#undef _Static_assert
static_assert(random_template<int, char>, "oops");
When running the preprocessor (with -E) I get
$ c++ -std=c++98 -pedantic-errors -E test.cpp >/dev/null
test.cpp:3:43: error: too many arguments provided to function-like macro
invocation
3 | static_assert(random_template<int, char>, "oops");
| ^
/usr/include/sys/cdefs.h:282:9: note: macro '_Static_assert' defined here
282 | #define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
| ^
1 error generated.
If I uncomment the #undef _Static_assert it preprocesses correctly and upon
compiling it gives the expected compiler error that static_assert is not
available.
--
You are receiving this mail because:
You are the assignee for the bug.