https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102790
Bug ID: 102790
Summary: Inactive ifdef block is checked on content validity
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: mykola.dolhyi at avid dot com
Target Milestone: ---
Even though expression inside inactive preprocessor #if block may not be a
valid C code, it should not fail compilation
Minimal example that trigger error:
~~~
#if 0
foo // compiles just fine
#endif
#if 0
§bar // will cause an error
#endif
~~~
GCC 9.4 compiles the example just fine, 10.1 fails, likely linked with changes
on gcc support for extended characters in identifiers.
Output of GCC 11.2:
~~~
<source>:6:1: error: extended character § is not valid in an identifier
6 | §bar // will cause an error
| ^
~~~
"-finput-charset=UTF-8 -fextended-identifiers" flags do not affect.