This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/23722] New: bad error recovery with if blocks and else
- From: "pinskia 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 Sep 2005 14:10:08 -0000
- Subject: [Bug c/23722] New: bad error recovery with if blocks and else
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
An example:
int f()
{
if (1)
{
return 1;
else
{
}
}
the else should cause us to close the } block and we should only have one error message. Right now we
have two:
t.c: In function ?f?:
t.c:6: error: expected expression before ?else?
t.c:9: error: expected declaration or statement at end of input
The reason why I only want one error message is that we only have to fix this one place.
----
If we do:
int f()
{
if (1)
{
return 1;
else
{
}
}
}
We get only one which is not fully correct as the block after the else was closed twice.
--
Summary: bad error recovery with if blocks and else
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23722