[Bug c++/12874] New: cannot declare throw (Exception) in class exception class itself

rmerkert at alphatech dot com gcc-bugzilla@gcc.gnu.org
Sun Nov 2 02:50:00 GMT 2003


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.



More information about the Gcc-bugs mailing list