This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16663] Poor error recovery
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Aug 2008 19:21:20 -0000
- Subject: [Bug c++/16663] Poor error recovery
- References: <bug-16663-6594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from manu at gcc dot gnu dot org 2008-08-04 19:21 -------
In GCC 4.4 we have:
pr16663.C:2: error: variable or field ?Foo? declared void
pr16663.C:2: error: ?misspelled? was not declared in this scope
pr16663.C:2: error: expected primary-expression before ?char?
pr16663.C:2: error: expected primary-expression before ?bool?
pr16663.C:2: error: expected primary-expression before ?float?
This is not easy to fix since that statement can be a function declaration but
also a variable declaration and initialization. We try to parse tentatively the
first case, fail, then we parse the second case and see that 'void' is not
allowed and that 'misspelled' is not declared.
If we have
int Bar(misspelled a, char b, bool c, float f);
then we get the full list of error messages:
pr16663.C:4: error: ?misspelled? was not declared in this scope
pr16663.C:4: error: expected primary-expression before ?char?
pr16663.C:4: error: expected primary-expression before ?bool?
pr16663.C:4: error: expected primary-expression before ?float?
pr16663.C:4: error: initializer expression list treated as compound expression
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2005-07-23 05:28:50 |2008-08-04 19:21:19
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16663