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

2024-11-11


1852. Wording issues regarding decltype(auto)

Section: 9.2.9.3  [dcl.type.simple]     Status: CD4     Submitter: Daveed Vandevoorde     Date: 2014-02-04

[Moved to DR at the November, 2014 meeting.]

According to 9.2.9.3 [dcl.type.simple] paragraph 2,

The auto specifier is a placeholder for a type to be deduced (9.2.9.7 [dcl.spec.auto]).

This is not true when auto appears in the decltype(auto) construct.

On a slightly related wording issue, 9.2.9.7 [dcl.spec.auto] paragraph 2 says,

The auto and decltype(auto) type-specifiers designate a placeholder type that will be replaced later, either by deduction from an initializer or by explicit specification with a trailing-return-type.

This could be read as implying that decltype(auto) can be used to introduce a function with a trailing-return-type, contradicting 9.3.4.6 [dcl.fct] paragraph 2, which requires that a function declarator with a trailing-return-type must have auto as the sole type specifier.

Proposed resolution (February, 2014):

  1. Change 9.2.9.3 [dcl.type.simple] paragraph 2 as follows:

  2. The simple-type-specifier auto specifier is a placeholder for a type to be deduced (9.2.9.7 [dcl.spec.auto]). The other simple-type-specifiers...
  3. Change 9.2.9.7 [dcl.spec.auto] paragraph 1 as follows:

  4. The auto and decltype(auto) type-specifiers are used to designate a placeholder type that will be replaced later, either by deduction from an initializer or by explicit specification with a trailing-return-type. The auto type-specifier is also used to introduce a function type having a trailing-return-type or to signify that a lambda is a generic lambda.