This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug report: internal compiler error on a throw statement

Hello everyone,

I have found an internal compiler error.

The following program:
class Exception {
    Exception() {}

class Exception2: public Exception {
    Exception2() {}
    virtual ~Exception2() {}

template<class T> class X {
    X() { }
    void Bad() { throw Exception2(); }

int main()
    X<int> A;
    return 0;

Causes the following internal compiler error:

> g++ -Wall In method `Exception2::Exception2(const class Exception2 &)': Internal compiler error 980521. Please submit a full bug report to `'.
Exit 1

I use the following compiler version:

> g++ -v
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.50/specs
gcc version egcs-2.91.50 19980714 (gcc2 ss-980609 experimental)

I know there is a more recent snapshot, but since I guess there will be
a new snapshot within days, I didn't bother to install it.

To get the ICE it is essential that the flag '-Wall' is set (I haven't
bothered to narrow down the guilty warning flag, sorry), that Exception2
inherits, that Exception2 has a destructor, and that X is a template

Also, when X is not a template class, but an ordinary class, the 'throw'
statement causes the warning 'statement has no effect', which looks odd
to me.

Kees van Reeuwijk, Delft University of Technology

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]