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

            Bug ID: 101628
           Summary: Preprocessor errors on extended characters in #if 0
                    code block
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.post at ohyonghao dot com
  Target Milestone: ---

In a #if 0 code block, the presence of characters outside the extended
character set being used as an identifier still gets passed to the C++ compiler
and errors out with the message:

error: extended character ∂ is not valid in an identifier

Sample code:

int main(int argc, char **argv){
#if 0
    Q_∂(false)
#endif
    return 0;
}

The code within the #if 0 block should never be compiled which is the behavior
of other compilers such as clang++ which gleefully ignores bad code within #if
0 block. 

To clarify, with clang++ the code errors without the #if 0 block, which is
expected behavior, and compiles with the #if 0 block around the bad code. g++
errors in both cases.

Reply via email to