[Bug c++/56084] poor error recovery for missing ";"

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 23 17:02:00 GMT 2013


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

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-01-23 17:02:02 UTC ---
> (Separately, I'm investigating whether there's some way to reduce the output
> when an invalid ostream operation is done, because the sheer number of
> overloads of operator<< causes pages of output due to G++'s verbose, and
> usually very useful, output describing argument deduction errors.)

One clear way is to avoid the repetition of:

In file included from
/home/manuel/test1/195333M/install/include/c++/4.8.0/iostream:40:0,
                 from test.cc:2:

Another is to add a "foverload-candidates-limit" option like
ftemplate-backtrace-limit, so if there are more than the limit (let's say 5),
the output is elided in a similar fashion.

Another suggestion is to don't show the full function declaration like in:

In file included from
/home/manuel/test1/195333M/install/include/c++/4.8.0/iostream:40:0,
                 from test.cc:2:
/home/manuel/test1/195333M/install/include/c++/4.8.0/ostream:532:5: note:
template<class _Traits> std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, const char*)
     operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
     ^
/home/manuel/test1/195333M/install/include/c++/4.8.0/ostream:532:5: note:  
template argument deduction/substitution failed:
test.cc:16:16: note:   cannot convert ‘me’ (type ‘Student’) to type ‘const
char*’
   std::cout << me << "\n";
                ^

where clang says in 1 line:

/usr/lib/gcc/x86_64-linux-gnu/4.4/../../../../include/c++/4.4/bits/ostream.tcc:320:5:
note: candidate function [with _CharT = char, _Traits = std::char_traits<char>]
not viable: no known conversion from 'Student' to 'const char *' for 2nd
argument
    operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)



More information about the Gcc-bugs mailing list