$14.6.2/3 - "In the definition of a class template or a member of a class template, if a base class of the class template depends on a template-parameter, the base class scope is not examined during unqualified name lookup either at the point of definition of the class template or member or during an instantiation of the class template or member."
As per this, the call 'f(0)'
in 'D::g'
should call 'B:f'
. However gcc(IdeOne) gives an ambiguit error.
Is this a bug in gcc? Comeau compiles it fine
template<class T, class U> struct A{
template<class A, class B> A f(B b){A a; return a;}
};
struct B{
double f(double d){return 0.0;}
};
template<class T, class U> struct D : A<T, U>, B{
void g(){f(0);}
};
int main(){
D<double, double> d;
d.g();
}