111
|
1 // { dg-options "-Wunused -W" }
|
|
2
|
|
3 #include <typeinfo>
|
|
4 #include <stdarg.h>
|
|
5
|
|
6 void
|
|
7 f1 (int a, ...)
|
|
8 {
|
|
9 va_list ap;
|
|
10 va_start (ap, a);
|
|
11 va_end (ap);
|
|
12 }
|
|
13
|
|
14 int
|
|
15 f2 (int a, ...)
|
|
16 {
|
|
17 va_list ap;
|
|
18 va_start (ap, a);
|
|
19 int i = va_arg (ap, int);
|
|
20 va_end (ap);
|
|
21 return i;
|
|
22 }
|
|
23
|
|
24 struct A { int a; A (); virtual ~A (); };
|
|
25 struct B : virtual A { int b; };
|
|
26
|
|
27 struct B *
|
|
28 f3 (struct A *a)
|
|
29 {
|
|
30 return dynamic_cast <B *> (a);
|
|
31 }
|
|
32
|
|
33 struct A *
|
|
34 f4 (struct B *a)
|
|
35 {
|
|
36 return static_cast <A *> (a);
|
|
37 }
|
|
38
|
|
39 struct A *
|
|
40 f5 (struct B *a)
|
|
41 {
|
|
42 return reinterpret_cast <A *> (a);
|
|
43 }
|
|
44
|
|
45 struct A *
|
|
46 f6 (const struct A *a)
|
|
47 {
|
|
48 return const_cast <A *> (a);
|
|
49 }
|
|
50
|
|
51 int
|
|
52 f7 (long a)
|
|
53 {
|
|
54 return (int) a;
|
|
55 }
|
|
56
|
|
57 int
|
|
58 f8 (long a)
|
|
59 {
|
|
60 return int (a);
|
|
61 }
|
|
62
|
|
63 struct C
|
|
64 {
|
|
65 operator unsigned int() { return 42; }
|
|
66 };
|
|
67
|
|
68 unsigned int
|
|
69 f9 ()
|
|
70 {
|
|
71 C u;
|
|
72 return u;
|
|
73 }
|
|
74
|
|
75 struct D
|
|
76 {
|
|
77 operator int & ();
|
|
78 operator const int & () const;
|
|
79 };
|
|
80
|
|
81 void foo (int &);
|
|
82 void foo (const int &);
|
|
83
|
|
84 void
|
|
85 f10 ()
|
|
86 {
|
|
87 const D x = D ();
|
|
88 foo (x);
|
|
89 }
|
|
90
|
|
91 int
|
|
92 f11 (int a)
|
|
93 {
|
|
94 return typeid (a) == typeid (int);
|
|
95 }
|
|
96
|
|
97 struct E
|
|
98 {
|
|
99 int e () {return 0;}
|
|
100 };
|
|
101
|
|
102 template <typename T>
|
|
103 int
|
|
104 f12 (E a)
|
|
105 {
|
|
106 __decltype (a.e()) i;
|
|
107 return i;
|
|
108 }
|
|
109
|
|
110 template <> int f12<int> (E);
|