Bug 20665 - poor diagnostic for missing semicolon at end of template struct declaration
Summary: poor diagnostic for missing semicolon at end of template struct declaration
Status: RESOLVED DUPLICATE of bug 16189
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2005-03-28 02:04 UTC by Ivan Godard
Modified: 2021-08-07 21:22 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-30 07:06:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Godard 2005-03-28 02:04:51 UTC
In:

template<typename T> class foo {}
enum A{b, c};


gets you:

~/ootbc/members/bin$ g++ foo.cc
foo.cc:2: error: template declaration of `enum A'
foo.cc:2: confused by earlier errors, bailing out

The actual error is a missing semicolon.

Ivan
Comment 1 Andrew Pinski 2005-03-28 02:07:20 UTC
On the mainline I get:
t.cc:1: error: template declaration of 'enum'
t.cc:2: error: multiple types in one declaration

There might be a dup of this bug somewhere.
Comment 2 Wolfgang Bangerth 2005-03-28 15:06:47 UTC
Yes, there are multiple PRs in the database about diagnostics when people 
forget the semicolon at the end of a struct or class declaration. There are 
also examples in these PRs that show why this case is so hard for the  
parser to handle gracefully. 
 
W. 
Comment 3 Andrew Pinski 2005-06-27 01:58:18 UTC
Confirmed.
Comment 4 Martin Michlmayr 2006-03-21 16:48:27 UTC
(In reply to comment #1)
> On the mainline I get:
> t.cc:1: error: template declaration of 'enum'
> t.cc:2: error: multiple types in one declaration
> 
> There might be a dup of this bug somewhere.

Bug #16189 is the same and has some information why it's so hard to improve the error message.  Please mark them a dupes.
Comment 5 Andrew Pinski 2006-03-21 16:50:28 UTC
(In reply to comment #4)
Ok.

*** This bug has been marked as a duplicate of 16189 ***