This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30144] New: Wrong base member lookup in template.
- From: "s__nakayama at infoseek dot jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2006 08:04:51 -0000
- Subject: [Bug c++/30144] New: Wrong base member lookup in template.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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