PR lto/84212 - -Wno-* does not disable warnings from -flto link stage
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wunused-var-2.C
blob0b21ef11625715e1b068b49267159a7740004914
1 // { dg-options "-Wunused -W" }
3 extern void foo ();
5 void
6 f1 ()
8   try
9     {
10       foo ();
11     }
12   catch (int i)
13     {
14     }
15   catch (double d)
16     {
17     }
20 void
21 f2 (int x)
23   int a = 0;
24   x++;
25   ++a;
28 struct A
30   bool foo () const { return true; }
33 int
34 f3 ()
36   A a;
37   bool b = a.foo ();
38   return b;
41 struct B
43   int i;
44   B (int j);
47 void
48 f4 ()
50   B b (6);
53 struct C
55   int i;
56   C (int j) : i (j) {}
59 void
60 f5 ()
62   C c (6);
65 struct D
67   int i;
68   D (int j) : i (j) {}
69   ~D ();
72 void
73 f6 ()
75   D d (6);
78 int *f7 (int s)
80   return new int[s];
83 template <typename T>
84 T *f8 (int s)
86   return new T[s];
89 template int *f8<int> (int);
91 void
92 f9 (char *p)
94   delete p;
97 template <typename T>
98 void
99 f10 (T *p)
101   delete p;
104 template void f10<char> (char *);