This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/30144] New: Wrong base member lookup in template.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]