CWG Issue 1852 (original) (raw)

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

2025-11-05


1852. Wording issues regarding decltype(auto)

Section: 9.2.9.3 [dcl.type.simple]Status: CD4Submitter: Daveed VandevoordeDate: 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 thedecltype(auto) construct.

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

The auto and decltype(auto) _type-specifier_s 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:

The simple-type-specifier auto specifieris a placeholder for a type to be deduced (9.2.9.7 [dcl.spec.auto]). The other _simple-type-specifier_s...

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

The auto and decltype(auto) _type-specifier_sare 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. Theauto 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.