https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66289

            Bug ID: 66289
           Summary: [5/6 Regression] "error: ambiguous template
                    instantiation" with partial specialization defined in
                    terms of alias template
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

5.1 and later incorrectly reject this, but it should compile because
foo<shared_ptr<A<T>>> is more specialized than foo<shared_ptr<T>>:


template<typename T> struct A {};

template<typename T> struct shared_ptr { };
template<typename T> using APtr = shared_ptr<A<T>>;

template<typename T> struct foo;
template<typename T> struct foo<shared_ptr<T>> { };
template<typename T> struct foo<APtr<T>> { };

foo<shared_ptr<A<int>>> aa;



amb.cc:10:25: error: ambiguous template instantiation for ‘struct
foo<shared_ptr<A<int> > >’
 foo<shared_ptr<A<int>>> aa;
                          ^
amb.cc:7:29: note: candidates are: template<class T> struct foo<shared_ptr<T> >
[with T = A<int>]
 template<typename T> struct foo<shared_ptr<T>> { };
                              ^
amb.cc:8:29: note:                 template<class T> struct foo<APtr<T> > [with
T = int]
 template<typename T> struct foo<APtr<T>> { };
                              ^
amb.cc:10:25: error: aggregate ‘foo<shared_ptr<A<int> > > aa’ has incomplete
type and cannot be defined
 foo<shared_ptr<A<int>>> aa;
                          ^

Reply via email to