Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


2376. Class template argument deduction with array declarator

Section:12.2.2.9  [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 besupported (in which case some mention of it in the wording wouldbe useful) or prohibited?

Notes from the November, 2018 meeting:

The example is intended to be ill-formed; the intent isthat declarator operators are not permitted, aswithdecltype(auto).

Proposed resolution, March, 2019:

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

If a placeholder for a deduced class type appears asadecl-specifier in thedecl-specifier-seq ofan initializing declaration (9.5 [dcl.init]) of avariable, thedeclared type of the variable shall becvT, whereT 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] Theplaceholder is replaced by the return type ofthe function selected by overload resolution for classtemplate deduction (12.2.2.9 [over.match.class.deduct]). Ifthedecl-specifier-seq is followed byaninit-declarator-listormember-declarator-list containing more than onedeclarator, the type that replaces the placeholder shall bethe same in each deduction.




[8]ページ先頭

©2009-2026 Movatter.jp