Debian Codegraph @

gcc/testsuite/g++.target/i386/pr35513-2.C

raw
1 // { dg-do run { target { *-*-linux* && property_1_needed } } }
2 // { dg-options "-O2 -mno-direct-extern-access" }
3
4 class Foo
5 {
6 public:
7 Foo(int n) : n_(n) { }
8 int f() { return n_; }
9
10 int badTest();
11 int goodTest();
12
13 private:
14
15 int n_;
16 };
17
18 int Foo::badTest()
19 {
20 try {
21 throw int(99);
22 }
23
24 catch (int &i) {
25 n_ = 16;
26 }
27
28 return n_;
29 }
30
31
32 int Foo::goodTest()
33 {
34 int n;
35
36 try {
37 throw int(99);
38 }
39
40 catch (int &i) {
41 n = 16;
42 }
43
44 return n_;
45 }
46
47 int main()
48 {
49 Foo foo(5);
50 foo.goodTest();
51 foo.badTest();
52 return 0;
53 }