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

--- Comment #1 from Tiziano Müller <dev-zero at gentoo dot org> ---
Unfortunately `__has_include` is even being parsed (in traditional-cpp mode) if
enclosed in a `if 0 ... endif`:

****snip****
#if 0
#if __has_include(<foo.h>)
#endif
#endif
****snip****

which gives:

****snip****
# 32 "<command-line>" 2
# 1 "test2.h"
test2.h:3: error: missing '(' before "__has_include" operand
    3 | #if __has_include(<foo.h>)
      | 
test2.h:3: error: operator "__has_include" requires a header-name
*** Error in
`/data/tiziano/cp2k/tools/toolchain/install/gcc-10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/cc1':
corrupted size vs. prev_size: 0x000000000249a7e0 ***
test2.h:1: confused by earlier errors, bailing out
****snip****

while enclosing it in parenthesis at least fixes that, such that the following
parses fine:

****snip****
#if 0
#if (__has_include(<foo.h>))
#endif
#endif
****snip****

Reply via email to