OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.robertl/] [ice990323-2.C] - Rev 853

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-do run  }
// check EH with templates
extern "C" void abort ();
extern "C" void exit (int);

template <class T, int n, class U> struct A {
        A() {}
        A(const char*) {}
};

void f1()
{
        throw *(new A<double, 47, A<int, 37, short> >);
}

void f2()
{
        throw *(new A<double, 47, A<int, 36, short> >);
}

void f3()
{
        throw A<double, 47, A<int, 37, short> > ("howdy");
}

void f4()
{
        throw A<double, 47, A<int, 36, short> > ("hi michey");
}

int main()
{
        int flag;

        flag = 0;
        try {
                f1();
        }
        catch (A<double, 47, A<int, 36, short> >) {
                abort();
        }
        catch (A<double, 47, A<int, 37, short> >) {
                flag = 1;
        }
        if (!flag)
                abort();

        flag = 0;
        try {
                f2();
        }
        catch (A<double, 47, A<int, 36, short&> >) {
                abort();
        }
        catch (A<double, 47, A<int, 36, short> >) {
                flag = 1;
        }
        if (!flag)
                abort();

        flag = 0;
        try {
                f3();
        }
        catch (A<double, 47, A<int, 36, short> >) {
                abort();
        }
        catch (A<double, 47, A<int, 37, short> >) {
                flag = 1;
        }
        if (!flag)
                abort();

        flag = 0;
        try {
                f4();
        }
        catch (A<double, 47, A<int, 36, short&> >) {
                abort();
        }
        catch (A<double, 47, A<int, 36, short> >) {
                flag = 1;
        }
        if (!flag)
                abort();

        exit(0);
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.