Overload resolution compilation error

Rodolfo Schulz de Lima rodolfo@rodsoft.org
Mon Jul 30 13:36:00 GMT 2007


Dave Korn escreveu:
>   Thanks, and do drop a note back with a summary of what you find out over
> there when you're done; if there's definitely a bug in gcc's understanding of
> the resolution rules, obviously we'd like to open a PR and get it fixed.

I think we have finally a consensus at

http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/52087a72bdc5de5a

Since the template parameter of the template function cannot be deduced, 
the only valid function for taking its address is the non-template one, 
so g++ should accept the code without error nor ambiguity.

During this week I've come along with another possibly related error:

template <class A0, class A1> void foo(A0, A1) {}
void bar()
{
     &foo<int,char>;
}

g++ signals an error, saying:

teste.cpp: In function ‘void bar()’:
teste.cpp:4: error: statement cannot resolve address of overloaded function

I'm trying to get the address of a correctly specialized template 
function, but g++ cannot resolve it. And there's no overload situation 
there, just void foo<int,char>(int, char) is being involved. I've not 
tested it with other compilers, but this bug is less subtle then the 
first one.







More information about the Gcc mailing list