Title
Literal operators and default arguments
Status
cd3
Section
12.6 [over.literal]
Submitter
Jason Merrill

Created on 2012-03-13.00:00:00 last changed 131 months ago

Messages

Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

Date: 2012-10-15.00:00:00

Proposed resolution (October, 2012):

Change 12.6 [over.literal] paragraph 3 as follows:

The declaration of a literal operator shall have a parameter-declaration-clause equivalent to one of the following:

...

If a parameter has a default argument (9.3.4.7 [dcl.fct.default]), the program is ill-formed.

Date: 2012-03-13.00:00:00

It appears that an example like

  int operator"" _a (const char *, std::size_t = 0);
  int operator"" _a (const char *);

  int i = 123_a;

is ambiguous: although only the second declaration is a raw literal operator, the corresponding call

  operator"" _a ("123")

could match either declaration. Should default arguments for literal operators be prohibited?

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4424
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetmessages: + msg4068
2012-11-03 00:00:00adminsetstatus: open -> ready
2012-03-13 00:00:00admincreate