Hi,

Consider the code

struct A{ 
        void fn(){cout << "1";} 
}; 

template<class T> 
struct B{ 
        void fn(){cout << "2";} 
}; 


template<class T> 
struct C : A, B<T>{ 
        C(){ fn(); }  // fn is a non dependent name. 
}; 

int main(){ 
        C<int> c; 
}

In this case, it looks fairly intuitive that the call to 'fn' is ambiguous.
However there are two things that I am not able to resolve

a) I cannot find anything in the Standard that talk about such a scenario.
Going by the rules of non dependent names (bound in lookup phase 1), fn should
be in fact bound to A::fn.

b) Comeau online compiler accepts this code and compiles it fine.

So, I want to confirm if gcc 4.1.1 behavior is right? Any relevant quotes from
the Standard will also help.

Regards,
Anubhav.


-- 
           Summary: Templates class instantiation -name lookup
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anubhav dot saxena at wipro dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39541

Reply via email to