This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45331] New: Generate clear diagnostics when a semicolon is missing at the end of a class definition
- From: "aaw at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Aug 2010 04:47:01 -0000
- Subject: [Bug c++/45331] New: Generate clear diagnostics when a semicolon is missing at the end of a class definition
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider this sample code:
# cat tst.cc
class X
{
public:
int a;
}
int foo(const X &x)
{
return x.a;
}
The clang front end generates a very nice warning (which is actually color
coded for ease of readability):
# clang ./tst.cc
./tst.cc:5:2: error: expected ';' after class
}
^
;
1 diagnostic generated.
By comparison, this is what gcc generates (in both Crosstool v14 and the
current upstream trunk):
# ./install/bin/gcc -c tst.cc
tst.cc:1:1: error: new types may not be defined in a return type
tst.cc:1:1: note: (perhaps a semicolon is missing after the definition of ?X?)
tst.cc:7:19: error: two or more data types in declaration of ?foo?
True, it *does* mention that there is likely a missing semicolon, but does it
really need to mention the other cruft, too? Why not just emit an error about
the semicolon, add the missing semicolon to the input stream, and continue
parsing the file?
--
Summary: Generate clear diagnostics when a semicolon is missing
at the end of a class definition
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: aaw at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45331