This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 111. See for the official list.


2376. Class template argument deduction with array declarator

Section:  [over.match.class.deduct]     Status: CD5     Submitter: Mike Miller     Date: 2018-03-01

[Accepted as a DR at the July, 2019 meeting.]

An example like

   template <class ...T> struct A {
     A(T...) {}
   A x[29]{};

Appears to be permitted by the current wording of the Standard, but existing implementations reject it. Should this usage be supported (in which case some mention of it in the wording would be useful) or prohibited?

Notes from the November, 2018 meeting:

The example is intended to be ill-formed; the intent is that declarator operators are not permitted, as with decltype(auto).

Proposed resolution, March, 2019:

Change [dcl.type.class.deduct] paragraph 1 as follows:

If a placeholder for a deduced class type appears as a decl-specifier in the decl-specifier-seq of an initializing declaration (9.4 [dcl.init]) of a variable, the declared type of the variable shall be cv T, where T is the placeholder. [Example:

  template <class ...T> struct A {
    A(T...) {}
  A x[29]{};    // error: no declarator operators allowed
  const A& y{}; // error: no declarator operators allowed

end example] The placeholder is replaced by the return type of the function selected by overload resolution for class template deduction ( [over.match.class.deduct]). If the decl-specifier-seq is followed by an init-declarator-list or member-declarator-list containing more than one declarator, the type that replaces the placeholder shall be the same in each deduction.