2009/4/14 Arthur Schwarz: > --- On Mon, 4/13/09, Joe Buck wrote: > > them all. >> >> Consider >> >> #include <iostream> >> struct Foo { int bar;}; >> int main() { >> std::cerr << Foo(); >> } >> >> Try it, the result is ugly, and I often encounter this one > > (Personal opinion - not to be construed as wisdom). > The issue with the result is: > 1: There is no end-of-line between candidates (or anywhere).
Do you mean there is no blank line, or no newline characters at all? I certainly get a newline after each candidate. Something's wrong if you don't. > 2: The candidate template is a large, untamed, and unruly beast. The bigger problem is there isn't a single candidate, but several. As suggested elsewhere, stlfilt helps make them more readable. > 3: The diagnostic message is not clear. I think it should say > that the compiler can't find something because of something. The 'because of something' is far from simple. How can the compiler tell you why there's no match for calling the operator with those argument types? It could be because of a typo, and one of the following was meant instead of Foo(): typedef int Food; int foo(); Or it could be that a header wasn't included, so the relevant operator hasn't been declared. Or it could be that there's an operator in scope for wide-character streams and the user meant to write to std::wcout. I don't see how the compiler can determine which of those, or other reasons, to point out. Giving the wrong suggestion could make things even worse, by misleading you and distracting you from the real cause. > 4: Providing a full template for each candidate is (indeed) > something of an overkill. Other than doing what stlfilt does, how could you show less than the full templates? The return type could be suppressed without loss of information, but Joe's suggestion of not showing all the matches strikes me as more useful than showing less of each match. Jonathan