https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119249
            Bug ID: 119249
           Summary: cpp manual: text about macro with the name of a
                    keyword should mention restrictions from the C/C++
                    standards
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net
  Target Milestone: ---

https://gcc.gnu.org/onlinedocs/gcc-14.2.0/cpp/Macros.html says: "You may define
any valid identifier as a macro, even if it is a C keyword. The preprocessor
does not know anything about keywords. This can be useful if you wish to hide a
keyword such as ‘const’ from an older compiler that does not understand it.
[...]"

However, this has some restrictions in ISO C (in particular since C11). C23
says in 7.1.2p5: "The program shall not have any macros with names lexically
identical to keywords currently defined prior to the inclusion of the header or
when any macro defined in the header is expanded."

And for C++, see PR109994.

Reply via email to