Created on 2023-03-16.00:00:00 last changed 17 months ago
CWG 2023-06-16
Forwarded to EWG with paper issue #1581.
Additional notes (May, 2023)
During additional discussion on the EWG reflector, Alisdair Meredith expressed that he intends to propose that some alternative tokens be treated as full keywords in phase 7, to prevent and from being used as an rvalue reference and compl from being used for naming destructors. That would reverse the above direction.
Furthermore, an idea was floated to treat all alternative tokens as full keywords in phase 7 and as identifiers in phase 4, amending the grammar productions for expressions as necessary. This removes the special treatment of alternative tokens entirely, however the treatment of examples such as #define and blah would change from ill-formed to well-formed. Some opposition was voiced against changing the phase 4 treatment of alternative tokens.
Proposed resolution (approved by CWG 2023-05-12):
Change in 5.2 [lex.phases] paragraph 2 as follows:
Whitespace characters separating tokens are no longer significant. Each preprocessing token is converted into a token (5.6 [lex.token]), replacing each alternative token by its corresponding primary token (5.5 [lex.digraph]). The resulting tokens constitute a translation unit and are syntactically and semantically analyzed and translated.
Change in 9.12.1 [dcl.attr.grammar] paragraph 4 as follows:
... If a keyword (5.11 [lex.key])or an alternative token (5.5 [lex.digraph])that satisfies the syntactic requirements of an identifier (5.10 [lex.name]) is contained in an attribute-token, it is considered an identifier. ...
This resolution also addresses issue 1897.
Subclause 5.5 [lex.digraph] paragraph 2 specifies:
In all respects of the language, each alternative token behaves the same, respectively, as its primary token, except for its spelling. [ Footnote: ... ]
However, 9.12.1 [dcl.attr.grammar] paragraph 4 specifies:
... If a keyword (5.11 [lex.key]) or an alternative token (5.5 [lex.digraph]) that satisfies the syntactic requirements of an identifier (5.10 [lex.name]) is contained in an attribute-token, it is considered an identifier. ...
It seems an alternative token (say, or) is treated the same as the operator ||, yet only the alternative token is considered an identifier, not the operator, when appearing in an attribute-token. That seems contradictory.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-06-16 17:02:47 | admin | set | messages: + msg7328 |
2023-05-24 18:54:04 | admin | set | messages: + msg7288 |
2023-05-24 18:54:04 | admin | set | status: ready -> review |
2023-05-12 20:59:33 | admin | set | messages: + msg7281 |
2023-05-12 20:59:33 | admin | set | status: open -> ready |
2023-03-16 00:00:00 | admin | create |