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++/18610] bad error message


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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-21 14:48:34 UTC ---
(In reply to comment #7)
> (In reply to comment #6)
> > N.B. that's even better than clang, as it tells you *why* substitution failed:
> > the specialization Q<int> is incomplete
> 
> Great! 
> 
> I agree it is better that it tells you *why*, but g++'s output is also
> extremely verbose: 2 diagnostics versus 8, plus the repetition of
> 'template<class T> F<typename Q<T>::t> g(const F<T>&)' and 'struct Q<int>'.
> Moreover, the use of "note" and "error" is inconsistent.
> 
> I would wish for something like:
> 
> t.cc:17:9: error: no matching function for call to 'g'

No, you need to know the argument types used for the call, not just the name of
the function called.

> t.cc:12:22: note: candidate template ignored: template argument
> deduction/substitution failed [with T = int]

Which candidate function?  If there are several 'g' overloads you will get a
note about each, I want them to be identified by more than the line they are
declared on.

> t.cc:12:22: note: reason: invalid use of incomplete type 'struct Q<int>'
> t.cc:2:8: note: declared here

This is just clang's output without the original source code snippets, which
would definitely not be an improvement.

> Current output will explode with large number of candidates and complex
> template instantiations (e.g., STL stuff). But that is an old problem, in
> general, and I guess hard to fix in g++.

That's the whole point - it shows you *all* the candidates, why they were not
viable, and the context that caused them to be instantiated - that's a Good
Thing.


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