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++/42356] improve list of candidates and error recovery for ambiguous call


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

--- Comment #14 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2011-10-23 00:46:15 UTC ---
(In reply to comment #13)
> (In reply to comment #11)
> > I wonder why the detailed overload failure that Nathan implemented does not
> > trigger here. I would expect to give details of why overload failed.
> 
> Name lookup fails due to the ambiguity, so overload resolution never happens. 
> The detailed overload resolution diagnostics won't be printed if overload
> resolution isn't done.

So you are saying that the candidates printed are simply all the matching names
that name lookup is able to find?

If so, I understand that the way g++ implements overload resolution makes not
trivial to give diagnostics, but still as Ivan agrees, it would be nice to be
able to sort viable candidates first, then not viable with details about why
they are not. This would require factoring out code to test overloads and
report diagnostics.

> > g++ could also specify which ones are viable candidates, and which ones are not
> > even viable, and for the ones not viable, explain why.
> 
> There are no viable candidates, because overload resolution is not performed.
> 
> Why bother performing overload resolution if the result of name lookup is
> ambiguous?  How does it help you resolve the ambiguity?

Yourself explained why above:

"Maybe that's the function you meant to call.  If you call a function with the
wrong number of args you want the compiler to tell you name lookup found
something, but overload resolution failed because the number of arguments
didn't match."


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