[Bug c++/16963] Ambiguity? Seems implausible

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 10 14:24:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-08-10 14:23 -------
icc rejects the code with the same error, though I must admit that I am 
at present at a loss as to why.  
 
A slightly simplified example is this: 
--------------------- 
template <typename T> 
struct Foo { 
    int Bar(T); 
}; 
 
struct R : public Foo<int>, public Foo<char> {}; 
 
int i = R().Bar(1); 
--------------------- 
 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc:8: error: request for member `Bar' is ambiguous 
x.cc:3: error: candidates are: int Foo<T>::Bar(T) [with T = char] 
x.cc:3: error:                 int Foo<T>::Bar(T) [with T = int] 
 
It is true that name lookup happens before argument conversion, but 
I can't at present explain why not both functions are found at the 
same time and then overload resolution happens. 
 
W. 

-- 


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



More information about the Gcc-bugs mailing list