Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dump candidates in function overload resolution?

How can I dump candidate functions (or viable functions or best viable functions) for a function invocation?

I know g++ provides an option to dump class hierarchy. (In fact, Visual Studio 2010 provides a similar option, but it's undocumented. I remember reading something about it—maybe in the VC++ team blog—but I can't remember it clearly.)

Recently, I have been reading about overload resolution in the C++0x draft, and it really embarrassed me.

Does any compiler provide an option to dump candidate functions, viable functions, or best viable functions?

Note: The candidate functions in overload resolution scenario is different from the candidate functions in the compiler error. The candidate/viable/best viable function in overload resolution scenario has their own meaning. I know their are three stages in overload resolution: find the candidate functions; find the viable functions; find the best viable functions. Normally, the best viable function is just one candidate; otherwise, the call is ambiguous. Each stage has their own rules.

like image 877
Yuncy Avatar asked Sep 20 '10 10:09

Yuncy


1 Answers

The easiest way to do this in Visual Studio is to compile an ambiguous call. The compiler will spit an error with a list of available candidates. Probably g++ will do the same.

like image 99
Yakov Galka Avatar answered Oct 15 '22 02:10

Yakov Galka