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

2024-12-19


984. “Deduced type” is unclear in auto type deduction

Section: 9.2.9.7  [dcl.spec.auto]     Status: CD2     Submitter: Michael Wong     Date: 19 October, 2009

[Voted into WP at March, 2010 meeting.]

9.2.9.7 [dcl.spec.auto] paragraph 6 says,

Once the type of a declarator-id has been determined according to 9.3.4 [dcl.meaning], the type of the declared variable using the declarator-id is determined from the type of its initializer using the rules for template argument deduction. Let T be the type that has been determined for a variable identifier d. Obtain P from T by replacing the occurrences of auto with either a new invented type template parameter U or, if the initializer is a braced-init-list (9.4.5 [dcl.init.list]), with std::initializer_list<U>. The type deduced for the variable d is then the deduced type determined using the rules of template argument deduction from a function call (13.10.3.2 [temp.deduct.call]), where P is a function template parameter type and the initializer for d is the corresponding argument.

The reference to “the deduced type” is unclear; it could be taken as referring either to the template parameter or to the function parameter type. 13.10.3.2 [temp.deduct.call] uses the term “deduced A,” and that usage should be repeated here.

Proposed resolution (October, 2009):

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

...The type deduced for the variable d is then the deduced type A determined using the rules of template argument deduction...