[Bug c++/16663] Poor parse error recovery with mispelled type in function declaration
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 11 20:36:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16663
--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-09-11 20:28:50 UTC ---
(In reply to comment #7)
>
> If 'void' is not allowed and 'misspelled' is not declared, then wouldn't it be
> better to recognize that case as an undeclared 'misspelled' instead of an
> impossible (or, at least, highly improbable) declaration of a variable of type
It could be possible to parse everything tentatively, and once everything
failed, try to guess why. But this is not a 10 minutes, one-liner fix, that is
what I mean by "not trivial".
> void? As things stand, GCC outputs a cryptic error message that is based on
> the expectation that a variable being declared with type void is both correct
> and the expected behaviour, and this isn't helpful.
We know it is not helpful, that is why this is marked as NEW and g++ devs would
be happy if someone submitted a patch fixing it. But so far, nobody has been
bothered by this issue enough to submit such patch.
BTW, clang avoids the errors-cascade but also gives the wrong "void" error:
/tmp/webcompile/_26781_1.cc:1:6: error: variable has incomplete type 'void'
void Foo(misspelled a, char b, bool c, float f);
^
/tmp/webcompile/_26781_1.cc:1:10: error: use of undeclared identifier
'misspelled'
void Foo(misspelled a, char b, bool c, float f);
^
More information about the Gcc-bugs
mailing list