g++ rejects following code. template<class T> struct B { void foo() { } };
template <class T> struct D: B<int>,B<T> { void bar() { foo(); } // call B<int>::foo() }; int main() { D<void> x; x.bar(); return 0; } ------------------------------------------- $ gcc cc.cpp cc.cpp: In member function 'void D<T>::bar() [with T = void]': cc.cpp:14: instantiated from here cc.cpp:8: error: request for member 'foo' is ambiguous cc.cpp:3: error: candidates are: void B<T>::foo() [with T = void] cc.cpp:3: error: void B<T>::foo() [with T = int] -- Summary: Wrong base member lookup in template. Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: s__nakayama at infoseek dot jp http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30144