[Bug c/20385] New: Lame error message for undefined type
falk at debian dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 8 18:21:00 GMT 2005
% 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
More information about the Gcc-bugs
mailing list