This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/20385] New: Lame error message for undefined type
- From: "falk at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Mar 2005 18:21:53 -0000
- Subject: [Bug c/20385] New: Lame error message for undefined type
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
% cat test.c
unknowntype f() { return 0; }
% gcc -c test.c
test.c:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'f'
Firstly, since this is a frequent mistake, we should really be able to produce
"unknowntype used like a type", as other compilers do.
Secondly, IMHO this kind of "expected ..." error message is *never* a good
idea. I cannot recall a single instance where it was actually helpful to me,
and very often, as in this case, it is extremely confusing, and I would be
better off with plain "syntax error before f" as it used to be in the old
parser. Even though my knowledge of C parsing is probably slightly above
average, I have not the slightest idea why the parser expects '=', ',', ';',
'asm' or '__attribute__' here, and what I can derive from that about the
mistake I made. But maybe that's just me.
--
Summary: Lame error message for undefined type
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: falk at debian dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20385