- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
is there an option for the compiler to print out the function candidate list it uses to determine that there's no such overload for the thing you are trying to call? It only tells me it can't find a matching function, not what the candidates are... GCC does this and it's extremely useful...
Thanks a lot in advance,
JJ
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!
Today I actually got a candidate list when the overload was ambiguous. So something is there. It just doesn't print a candidate list of none of them match...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you share the bits of code that gave the candidate list in compile error, as Iam not able to get how you are able to get..
leaving that, does it then satisfy your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is an example of the ambiguous overload use case that will generate a candidate list:
[cpp]struct foo_t { foo_t ( int ){} }; struct bar_t { bar_t ( int ){} }; class FBTest { void func( foo_t ) {} void func( bar_t ) {} }; int main( int, char ** ) { FBTest c_object; c_object.func( 5 ); return 0; } [/cpp]
And the candidate list:
[plain]$ icpc ambiguous.cpp ambiguous.cpp(15): error: more than one instance of overloaded function "FBTest::func" matches the argument list: function "FBTest::func(foo_t)" function "FBTest::func(bar_t)" argument types are: (int) object type is: FBTest c_object.func( 5 ); ^[/plain]
That's a fine compiler error which could only be improved by showing the line numbers of the candidates.
Here, on the other hand, is an example .cpp that shows the lack of a candidate list if none of the overloads match:[cpp]struct foo_t { foo_t (){} }; static const foo_t foo; struct bar_t { bar_t (){} }; static const bar_t bar; struct foo_bar_t { foo_bar_t(){} }; static const foo_bar_t foo_bar; class FBTest { void func( foo_t ) {} void func( bar_t ) {} }; int main( int, char ** ) { FBTest c_object; c_object.func( foo_bar ); return 0; } [/cpp]
Here is what ICC prints out:
[plain]$ icpc candidates.cpp candidates.cpp(16): error: no instance of overloaded function "FBTest::func" matches the argument list argument types are: (const foo_bar_t) object type is: FBTest c_object.func( foo_bar ); ^[/plain]
This isn't very helpful... For comparison, GCC produces a candidate list for the same code:
[plain]$ g++ candidates.cpp candidates.cpp: In function `int main(int, char**)': candidates.cpp:16: error: no matching function for call to `FBTest::func(const foo_bar_t&)' candidates.cpp:8: note: candidates are: void FBTest::func(foo_t) candidates.cpp:9: note: void FBTest::func(bar_t)[/plain]
BTW, here's my ICC version string: "icpc (ICC) 11.1 20091130"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have submitted a feature request to Intel compiler development team. I willinform the forum users when there is update on this.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page