Projet_SETI_RISC-V/riscv-gnu-toolchain/gcc/gcc/testsuite/g++.target/i386/pr35513-2.C
2023-03-06 14:48:14 +01:00

54 lines
555 B
C

// { dg-do run { target { *-*-linux* && property_1_needed } } }
// { dg-options "-O2 -mno-direct-extern-access" }
class Foo
{
public:
Foo(int n) : n_(n) { }
int f() { return n_; }
int badTest();
int goodTest();
private:
int n_;
};
int Foo::badTest()
{
try {
throw int(99);
}
catch (int &i) {
n_ = 16;
}
return n_;
}
int Foo::goodTest()
{
int n;
try {
throw int(99);
}
catch (int &i) {
n = 16;
}
return n_;
}
int main()
{
Foo foo(5);
foo.goodTest();
foo.badTest();
return 0;
}