Title
Out-of-class partial specializations of member templates
Status
drafting
Section
13.7.6.4 [temp.spec.partial.member]
Submitter
Richard Smith

Created on 2013-09-19.00:00:00 last changed 114 months ago

Messages

Date: 2014-11-24.00:00:00

Additional note, November, 2014:

See also paper N4090.

Date: 2014-02-15.00:00:00

Notes from the February, 2014 meeting:

CWG decided that partial specialization declarations should be instantiated only when needed to determine whether the partial specialization matches or not.

Date: 2022-06-11.20:21:09

According to 13.7.6.4 [temp.spec.partial.member] paragraph 2,

If a member template of a class template is partially specialized, the member template partial specializations are member templates of the enclosing class template; if the enclosing class template is instantiated (13.9.2 [temp.inst], 13.9.3 [temp.explicit]), a declaration for every member template partial specialization is also instantiated as part of creating the members of the class template specialization.

Does this imply that only partial specializations of member templates that are declared before the enclosing class is instantiated are considered? For example, in

  template<typename A> struct X { template<typename B> struct Y; };
  template struct X<int>;
  template<typename A> template<typename B> struct X<A>::Y<B*> { int n; };
  int k = X<int>::Y<int*>().n;

is the last line valid? There is implementation variance on this point. Similarly, for an example like

  template<typename A> struct Outer {
   template<typename B, typename C> struct Inner;
  };
  Outer<int> outer;
  template<typename A> template<typename B>
    struct Outer<A>::Inner<typename A::error, B> {};

at what point, if at all, is the declaration of the partial specialization instantiated? Again, there is implementation variance in the treatment of this example.

History
Date User Action Args
2014-11-24 00:00:00adminsetmessages: + msg5221
2014-03-03 00:00:00adminsetmessages: + msg4893
2014-03-03 00:00:00adminsetstatus: open -> drafting
2013-09-19 00:00:00admincreate