public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45331]  New: Generate clear diagnostics when a semicolon is missing at the end of a class definition
@ 2010-08-19  4:47 aaw at gcc dot gnu dot org
  2010-08-19 12:11 ` [Bug c++/45331] " redi at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: aaw at gcc dot gnu dot org @ 2010-08-19  4:47 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/45331] Generate clear diagnostics when a semicolon is missing at the end of a class definition
  2010-08-19  4:47 [Bug c++/45331] New: Generate clear diagnostics when a semicolon is missing at the end of a class definition aaw at gcc dot gnu dot org
@ 2010-08-19 12:11 ` redi at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-08-19 12:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from redi at gcc dot gnu dot org  2010-08-19 12:11 -------
Bug 16189 and Bug 36888


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45331


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-19 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-19  4:47 [Bug c++/45331] New: Generate clear diagnostics when a semicolon is missing at the end of a class definition aaw at gcc dot gnu dot org
2010-08-19 12:11 ` [Bug c++/45331] " redi at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).