This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


985. Alternative tokens and user-defined literals

Section: 5.5  [lex.digraph]     Status: C++11     Submitter: Michael Wong     Date: 19 October, 2009

5.11 [lex.key] paragraph 2 says,

Furthermore, the alternative representations shown in Table 4 for certain operators and punctuators (5.5 [lex.digraph]) are reserved and shall not be used otherwise:

Also, 5.5 [lex.digraph] paragraph 2 says,

In all respects of the language, each alternative token behaves the same, respectively, as its primary token, except for its spelling.

It is not clear whether the following example is well-formed:

    #define STR2(x)  #x
    #define STR(x)   STR2(x)
    int main() {
        return sizeof STR('\0'bitor 0) - sizeof STR('\0'bitor 0);
    }

In this example, bitor is not the | operator but the identifier in a user-defined-character-literal. Does this violate the restrictions of 5.11 [lex.key] and 5.5 [lex.digraph]?

Proposed resolution (March, 2011):

This issue is resolved by the resolution of issue 1239 in document N3262, since literal suffix identifiers must begin with an underscore.