Bug 30144 - Wrong base member lookup in template.
Summary: Wrong base member lookup in template.
Status: RESOLVED DUPLICATE of bug 15272
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-11 08:04 UTC by s.nakayama
Modified: 2006-12-11 08:09 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description s.nakayama 2006-12-11 08:04:50 UTC
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]
Comment 1 Andrew Pinski 2006-12-11 08:09:48 UTC

*** This bug has been marked as a duplicate of 15272 ***