[cfe-dev] #define keyword

Seth Cantrell seth.cantrell at gmail.com
Thu Jun 20 09:53:02 PDT 2013


C++11 [macro.names] 17.6.6.3.1 p2 states

> A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 3, or to the attribute-tokens described in 7.6.

As I understand it this means a program that does this is ill-formed,
with a diagnostic required. Clang does not produce any diagnostics for
such defines/undefs. Am I correct that a diagnostic is required? This
doesn't sound like it would be too difficult to implement. Is there a
reason not to have clang produce a warning for this (one that wouldn't
trigger in system headers)?



More information about the cfe-dev mailing list