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


996. Ambiguous partial specializations of member class templates

Section: 13.7.6  [temp.spec.partial]     Status: C++11     Submitter: Doug Gregor     Date: 28 Oct, 2009

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

Given an example like

  template<typename T, typename U>
  struct Outer {
    template<typename X, typename Y> struct Inner;
    template<typename Y> struct Inner<T, Y> {};
    template<typename Y> struct Inner<U, Y> {};
  };
  Outer<int, int> outer;                      // #1
  Outer<int, int>::Inner<int, float> inner;   // #2

Is #1 ill-formed because of the identical partial specializations? If not, presumably #2 is ill-formed because of the resulting ambiguity (13.7.6.2 [temp.spec.partial.match] paragraph 1).

Notes from the November, 2010 meeting:

The instantiation of Outer<int,int> results in duplicate declarations of the partial specialization, which are ill-formed by 11.4 [class.mem] paragraph 1. No normative change is required, but it might be helpful to add an example like this somewhere.