Open xmh0511 opened 10 months ago
I've opened #226 for this.
BTW, I think it's intended to disallow user codes to call functions with reserved names that are implementations details of the standard library, since such calls may break invariants.
~Perhaps we should explicitly allow using standard macros with reserved names in any way except for #define
and #undef
. It is explicitly undefined behavior in C to #undef
such a macro.~
Edit: [cpp.predefined] p4 has already achieved the same thing (see also CWG2581). So for the core wording, I think we can just exclude predefined macros in [lex.name] p3.
Full name of submitter (unless configured in github; will be published with the issue): Jim X
[lex.name] p3 says
Consider this case:
At
#1
, we use the macro name__cplusplus
in translation phase 4, which is a preprocessing-token at that time. That means, we can never use any predefined macro names.Suggested Resolution
"use" in this phrasing has many interpretations, presumably, the rule just wants to prohibit users to introduce that name rather than use them?