Title
auto as conversion-type-id
Status
review
Section
9.2.9.7 [dcl.spec.auto]
Submitter
Richard Smith

Created on 2013-04-26.00:00:00 last changed 2 weeks ago

Messages

Date: 2025-08-15.00:00:00

Additional note (August, 2025):

CWG appears to be leaning towards making declarations of operator auto ill-formed. Forwarding to EWG for approval of that direction via paper issue #2409, by decision of the CWG chair.

Possible resolution:

Change in 9.2.9.7.1 [dcl.spec.auto.general] paragraph 4 as follows:

A placeholder type can appear in the decl-specifier-seq or type-specifier-seq in the declared return type of a function declarator that declares a function other than a conversion function (11.4.8.3 [class.conv.fct]); the return type of the function is deduced from non-discarded return statements, if any, in the body of the function (8.5.2 [stmt.if]).
Date: 2021-12-15.00:00:00

Additional note (December, 2021):

See duplicate issue 2493 for additional details.

Date: 2014-02-15.00:00:00

Notes from the February, 2014 meeting:

CWG continued to express doubt as to the usefulness of this construct but felt that if it is permitted, the rules need clarification.

Date: 2014-01-20.00:00:00

Additional note, November, 2013:

Doubt was expressed during the 2013-11-25 drafting review teleconference as to the usefulness of this provision. It is therefore being left open for further consideration after C++14 is finalized.

Date: 2025-08-12.21:28:19
N3690 comment FIĀ 4

(See also submission #736.)

The current wording allows something like

  struct S {
    operator auto() { return 0; }
  };

If it is intended to be permitted, the details of its handling are not clear. Also, a similar syntax has been discussed as a possible future extension for dealing with proxy types in deduction which, if adopted, could cause confusion.

History
Date User Action Args
2025-08-12 21:44:32adminsetmessages: + msg8068
2025-08-11 12:30:47adminsetstatus: drafting -> review
2022-01-06 00:00:00adminsetmessages: + msg6611
2014-03-03 00:00:00adminsetmessages: + msg4878
2014-03-03 00:00:00adminsetstatus: open -> drafting
2014-01-20 00:00:00adminsetmessages: + msg4765
2013-04-26 00:00:00admincreate