Bug 12879 - [3.4 Regression] double error message when using incomplete types in a struct
Summary: [3.4 Regression] double error message when using incomplete types in a struct
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 minor
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2003-11-02 22:28 UTC by Andrew Pinski
Modified: 2005-04-13 00:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-12-07 06:47:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2003-11-02 22:28:07 UTC
The following code produces the two error messages in 3.4 while does not in 3.3.
struct Exception {
  static void raise () throw (Exception){ throw Exception(); }
};
Comment 1 Wolfgang Bangerth 2003-11-03 16:11:02 UTC
Confirmed. We get
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc:2: error: invalid use of undefined type `struct Exception'
x.cc:1: error: forward declaration of `struct Exception'
x.cc:2: error: invalid use of undefined type `struct Exception'
x.cc:1: error: forward declaration of `struct Exception'
Comment 2 Mark Mitchell 2003-12-15 21:16:22 UTC
Already fixed in GCC 3.4.
Comment 3 Colm McHugh 2005-04-13 00:56:54 UTC
Broken in 3.4.3 on AIX 5.2;

$ cat x.cpp
struct Exception {
  static void raise () throw (Exception){ throw Exception(); }
};
$ g++ x.cpp
x.cpp:2: error: invalid use of undefined type `struct Exception'
x.cpp:1: error: forward declaration of `struct Exception'
Comment 4 Gabriel Dos Reis 2005-04-13 01:08:44 UTC
Subject: Re:  [3.4 Regression] double error message when using incomplete types in a struct

"cmchugh at callixa dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From cmchugh at callixa dot com  2005-04-13 00:56 -------
| Broken in 3.4.3 on AIX 5.2;
| 
| $ cat x.cpp
| struct Exception {
|   static void raise () throw (Exception){ throw Exception(); }
| };
| $ g++ x.cpp
| x.cpp:2: error: invalid use of undefined type `struct Exception'

preferably

  static void raise () throw (Exception){ throw Exception(); }
                       ^^^^^^^^^^^^^^^^^
  "class 'Exception' is considered incomplete at this point, therefore
   cannot be used as an exception type in an exception-specification.

We do not have carret diagnostic yet, but we can improve on the error
message :-)

-- Gaby