https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113532
Bug ID: 113532
Summary: Warn about definition of macros that shadow keywords
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Blocks: 87403
Target Milestone: ---
[macro.names] says:
A translation unit shall not #define or #undef names lexically identical to
keywords, to the identifiers listed in Table 4, or to the attribute-tokens
described in 9.12, except that the names likely and unlikely may be defined as
function-like macros (15.6).
(Where Table 4 contains "final", "import", "module", and "override".)
We should warn when code does something silly like:
#define namespace _namespace
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning