views:

100

answers:

1

$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();
}
+4  A: 

I think it is a known bug in GCC. According to the bug report, your example fails as late as GCC 4.4.0. I think that just means it hasn't been tested on a newer version though - not that it's been fixed.

Kristo
@Kristo: Vow!. Thanks for the reference
Chubsdad