111
|
1 // { dg-options "-Wunused -W" }
|
|
2
|
|
3 extern void foo ();
|
|
4
|
|
5 void
|
|
6 f1 ()
|
|
7 {
|
|
8 try
|
|
9 {
|
|
10 foo ();
|
|
11 }
|
|
12 catch (int i)
|
|
13 {
|
|
14 }
|
|
15 catch (double d)
|
|
16 {
|
|
17 }
|
|
18 }
|
|
19
|
|
20 void
|
|
21 f2 (int x)
|
|
22 {
|
|
23 int a = 0;
|
|
24 x++;
|
|
25 ++a;
|
|
26 }
|
|
27
|
|
28 struct A
|
|
29 {
|
|
30 bool foo () const { return true; }
|
|
31 };
|
|
32
|
|
33 int
|
|
34 f3 ()
|
|
35 {
|
|
36 A a;
|
|
37 bool b = a.foo ();
|
|
38 return b;
|
|
39 }
|
|
40
|
|
41 struct B
|
|
42 {
|
|
43 int i;
|
|
44 B (int j);
|
|
45 };
|
|
46
|
|
47 void
|
|
48 f4 ()
|
|
49 {
|
|
50 B b (6);
|
|
51 }
|
|
52
|
|
53 struct C
|
|
54 {
|
|
55 int i;
|
|
56 C (int j) : i (j) {}
|
|
57 };
|
|
58
|
|
59 void
|
|
60 f5 ()
|
|
61 {
|
|
62 C c (6);
|
|
63 }
|
|
64
|
|
65 struct D
|
|
66 {
|
|
67 int i;
|
|
68 D (int j) : i (j) {}
|
|
69 ~D ();
|
|
70 };
|
|
71
|
|
72 void
|
|
73 f6 ()
|
|
74 {
|
|
75 D d (6);
|
|
76 }
|
|
77
|
|
78 int *f7 (int s)
|
|
79 {
|
|
80 return new int[s];
|
|
81 }
|
|
82
|
|
83 template <typename T>
|
|
84 T *f8 (int s)
|
|
85 {
|
|
86 return new T[s];
|
|
87 }
|
|
88
|
|
89 template int *f8<int> (int);
|
|
90
|
|
91 void
|
|
92 f9 (char *p)
|
|
93 {
|
|
94 delete p;
|
|
95 }
|
|
96
|
|
97 template <typename T>
|
|
98 void
|
|
99 f10 (T *p)
|
|
100 {
|
|
101 delete p;
|
|
102 }
|
|
103
|
|
104 template void f10<char> (char *);
|