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

2024-03-20


1107. Overload resolution for user-defined integer literals

Section: 5.13.9  [lex.ext]     Status: C++11     Submitter: US     Date: 2010-08-02

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

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.

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 )