Title
Overload resolution for user-defined integer literals
Status
c++11
Section
5.13.9 [lex.ext]
Submitter
US

Created on 2010-08-02.00:00:00 last changed 131 months ago

Messages

Date: 2010-11-15.00:00:00

[Voted into the WP at the November, 2010 meeting.]

Date: 2010-08-15.00:00:00

Proposed resolution (August, 2010):

Change 5.13.9 [lex.ext] paragraph 6 as follows:

If L is a user-defined-character-literal, let ch be the literal without its ud-suffix. The S shall contain a literal operator (12.6 [over.literal]) whose only parameter has the type of ch and the literal L is treated as a call of the form
    operator "" X (ch )
Date: 2010-08-02.00:00:00
N3092 comment USĀ 17

In general, the parameter type of a literal operator must be the same as the argument passed to it. That is not the case for a user-defined-character-literal, where the argument could inadvertently match a literal operator intended for use with user-defined-integer-literals:

    typedef unsigned long long ULL;
    int operator "" X(ULL);
    int i = 'c'X; // operator"" X(ULL('c'))

Suggested resolution: Add the following phrase to the description in paragraph 6:

S shall contain a literal operator whose parameter type is the same as the type of ch.
History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: dr -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3144
2010-11-29 00:00:00adminsetstatus: ready -> dr
2010-08-23 00:00:00adminsetmessages: + msg2756
2010-08-02 00:00:00admincreate