http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57327
Bug ID: 57327
Summary: 'derived' is an ambiguous base class of 'base'
diagnostic is bacwards
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
struct A {};
template<class T, class U>
void f(A<T, U>&) {}
template<class T>
struct B : A<T, long> {};
template<class T>
struct C : A<T, char> {};
template<class T>
struct D : B<T>, C<T> {};
int main()
{
D<int> d;
f(d);
}
ambig.cc: In function ‘int main()’:
ambig.cc:19:6: error: no matching function for call to ‘f(D<int>&)’
ambig.cc:19:6: note: candidate is:
ambig.cc:5:6: note: template<class T, class U> void f(A<T, U>&)
ambig.cc:5:6: note: template argument deduction/substitution failed:
ambig.cc:19:6: note: ‘D<int>’ is an ambiguous base class of ‘A<T, U>’
G++ is right to reject the code, but note the last line of the diagnostic which
says D is a base class of A, which is backwards.