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(); } };
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'
Already fixed in GCC 3.4.
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'
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