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

2023-01-15


1265. Mixed use of the auto specifier

Section: 9.2.9.6  [dcl.spec.auto]     Status: CD3     Submitter: Michael Wong     Date: 2011-03-20

[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]

The current wording of 9.2.9.6 [dcl.spec.auto] does not appear to forbid using the auto specifier for both a function declaration with a trailing return type and a variable definition in the same declaration, e.g.,

    auto f() -> int, i = 0;

(See also issue 1347.)

Proposed resolution (August, 2011):

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

If the list of declarators contains more than one declarator, they shall all form declarations of variables. The the type of each declared variable is determined as described above. If, and if the type deduced for the template parameter U is not the same in each deduction, the program is ill-formed. [Example:...