Title
Alternative tokens and user-defined literals
Status
c++11
Section
5.5 [lex.digraph]
Submitter
Michael Wong

Created on 2009-10-19.00:00:00 last changed 123 months ago

Messages

Date: 2011-03-15.00:00:00

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.

Date: 2009-10-19.00:00:00

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]?

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3284
2011-04-10 00:00:00adminsetstatus: open -> fdis
2009-10-19 00:00:00admincreate