https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60304

--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #19) 
> This is exactly what G++'s stdbool.h is doing with -std=gnu++98 and
> -std=c++98.

<stdbool.h> is a "header" which is C++ standardese for a standard library
header. The rule only applies to user code, not std::lib headers. In your
testcase sys.h is OK but nonsys.h is not.

Although you can argue that since <stdbool.h> is not defined by the C++98
standard it is not a "header" and must not define the macro in __STRICT_ANSI__
mode.

> (Also, why is this not an error with -std=c++11 -pedantic-errors?)

Because noone has ever implemented the diagnostic. Note that it only applies to
user-code that includes a "header" so it's OK to define macros using the names
of keywords as long as you never include a standard header. That makes it a bit
more complicated to implement the diagnostic.

Reply via email to