This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12874] New: cannot declare throw (Exception) in class exception class itself
- From: "rmerkert at alphatech dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Nov 2003 02:50:07 -0000
- Subject: [Bug c++/12874] New: cannot declare throw (Exception) in class exception class itself
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12874
Summary: cannot declare throw (Exception) in class exception
class itself
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rmerkert at alphatech dot com
CC: gcc-bugs at gcc dot gnu dot org
The following code does not compile with either 3.3.2 or 3.4
cat > test.cpp <<EOF
struct Exception {
static void raise () throw (Exception); //{ throw Exception(); }
};
EOF
gcc -c test.cpp
and produces:
test.cpp:2: error: invalid use of undefined type `struct Exception'
test.cpp:1: error: forward declaration of `struct Exception'
with 3.3.2 and 3.4
The error is triggered by "throw (Exception)" i.e. if it's removed then the code
compiles.
Note that 3.4 behaves quite funny, because with the method body it emits the
eror message twice.
Is this indeed a valid error? I'd like to think that it's a bug.