PR lto/84212 - -Wno-* does not disable warnings from -flto link stage
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wunused-var-3.C
blobcd8931d71c92207a1f0099f76fbe4f87064cf23d
1 // { dg-options "-Wunused -W" }
3 #include <typeinfo>
4 #include <stdarg.h>
6 void
7 f1 (int a, ...)
9   va_list ap;
10   va_start (ap, a);
11   va_end (ap);
14 int
15 f2 (int a, ...)
17   va_list ap;
18   va_start (ap, a);
19   int i = va_arg (ap, int);
20   va_end (ap);
21   return i;
24 struct A { int a; A (); virtual ~A (); };
25 struct B : virtual A { int b; };
27 struct B *
28 f3 (struct A *a)
30   return dynamic_cast <B *> (a);
33 struct A *
34 f4 (struct B *a)
36   return static_cast <A *> (a);
39 struct A *
40 f5 (struct B *a)
42   return reinterpret_cast <A *> (a);
45 struct A *
46 f6 (const struct A *a)
48   return const_cast <A *> (a);
51 int
52 f7 (long a)
54   return (int) a;
57 int
58 f8 (long a)
60   return int (a);
63 struct C
65   operator unsigned int() { return 42; }
68 unsigned int
69 f9 ()
71   C u;
72   return u;
75 struct D
77   operator int & ();
78   operator const int & () const;
81 void foo (int &);
82 void foo (const int &);
84 void
85 f10 ()
87   const D x = D ();
88   foo (x);
91 int
92 f11 (int a)
94   return typeid (a) == typeid (int);
97 struct E
99   int e () {return 0;}
102 template <typename T>
104 f12 (E a)
106   __decltype (a.e()) i;
107   return i;
110 template <> int f12<int> (E);