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

2024-12-19


1727. Type of a specialization of a variable template

Section: 13.9.4  [temp.expl.spec]     Status: NAD     Submitter: Larisse Voufo     Date: 2013-08-05

It is not clear whether there is any necessary relationship between the type specified in a primary variable template declaration and the type in an explicit or partial specialization. For example:

  template<typename T> T var = T();
  template<> char var<char> = 'a';           // #1.
  template<typename T> T* var<T> = new T();  // #2.
  template<> float var<int> = 1.5;           // #3.

Rationale (September, 2013):

CWG affirmed that there is no required relationship between the type of the template and the type of a partial or explicit specialization of that template.