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


1588. Deducing cv-qualified auto

Section: 9.2.9.7  [dcl.spec.auto]     Status: CD3     Submitter: Jens Maurer     Date: 2012-11-18

In an example like

  const auto x = 3;

the intent, clearly, is to make const int the type of x. It is not clear, however, that the current wording accomplishes this. Because the deduction is based on that of function calls, and because top-level cv-qualifiers are ignored in such deduction, it appears that 9.2.9.7 [dcl.spec.auto] paragraph 6,

The type deduced for the variable d is then the deduced A 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.

incorrectly gives x the type int.

Proposed resolution (April, 2013):

This issue is resolved by the wording changes in N3638, adopted at the April, 2013 (Bristol) meeting.