Title
decltype(auto) and void
Status
cd4
Section
9.2.9.7 [dcl.spec.auto]
Submitter
Richard Smith

Created on 2014-11-14.00:00:00 last changed 25 months ago

Messages

Date: 2015-09-15.00:00:00

Proposed resolution (September, 2015):

Change 9.2.9.7 [dcl.spec.auto] paragraph 7 as follows:

When a variable declared using a placeholder type is initialized, or a return statement occurs in a function declared with a return type that contains a placeholder type, the deduced return type or variable type is determined from the type of its initializer. In the case of a return with no operand or with an operand of type void,:

  • if the declared return type is decltype(auto), then the deduced return type is void;

  • otherwise, the declared return type shall be cv auto and the deduced return type is cv void.

Otherwise, let T be...

Date: 2022-02-18.07:47:23

Suggested resolution:

Change 9.2.9.7 [dcl.spec.auto] paragraph 7 as follows:

...In the case of a return with no operand or with an operand of type void, the declared return type shall be auto or decltype(auto) and the deduced return type is void. Otherwise...
Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

The resolution of issue 1877 does not correctly handle decltype(auto) return types with void return expressions:

  T f();
  decltype(auto) g() { return f(); }

fails when T is void.

History
Date User Action Args
2022-02-18 07:47:23adminsetmessages: + msg6709
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2015-11-10 00:00:00adminsetmessages: + msg5597
2015-11-10 00:00:00adminsetstatus: drafting -> tentatively ready
2014-11-14 00:00:00admincreate