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

2025-04-13


2237. Can a template-id name a constructor?

Section: 11.4.5  [class.ctor]     Status: CD5     Submitter: Faisal Vali     Date: 2016-03-02

[Accepted at the March, 2018 (Jacksonville) meeting.]

Bullet 1.2 of 11.4.5 [class.ctor], describing declarator forms that are considered to declare a constructor, says:

...and the id-expression has one of the following forms:

The term class-name includes simple-template-id. It is not clear that allowing a constructor declaration of the form

  template<class T> struct X {
    X<T>(T); // constructor 
  };

is useful or helpful.

Proposed resolution (November, 2017)

  1. Change 11.4.5 [class.ctor] paragraph 1 as follows:

  2. ...and the id-expression has one of the following forms:

  3. Change 11.4.7 [class.dtor] paragraph 1 as follows:

  4. ...and the id-expression has one of the following forms:

  5. Add the following as a new paragraph in C.3 [diff.cpp17]:

  6. 
    

(Note that this resolution is a change for C++20, NOT a defect report against C++17 and earlier versions.)