pr77285-2.C: Require tls_native support.
[gcc.git] / gcc / testsuite / g++.dg / pr84943-2.C
1 // { dg-do run }
2
3 // Avoid -pedantic-error default
4 // { dg-options "" }
5
6 // Make sure the functions referenced by various forms of
7 // address-taking are marked as used and compiled in.
8
9 static void ac() {}
10 void a() {
11 ac[0](); // { dg-warning "arithmetic" }
12 }
13
14 static void bc() {}
15 void b() {
16 (&*&*&*&bc)();
17 }
18
19 template <typename U> U cc() {}
20 void (*c())() {
21 return cc;
22 }
23
24 template <typename T>
25 struct x {
26 void a(int);
27 template <typename U> static U a(x*) {}
28 static void a(long) {}
29 static void a(void *) {}
30 static void a() {
31 void (*p0)(void*) = x().a;
32 p0(0);
33 void (*p1)(long) = a;
34 p1(0);
35 void (*p2)() = a;
36 p2();
37 void (*p3)(x*) = a;
38 p3(0);
39 }
40 };
41
42 struct z {
43 void a(int);
44 template <typename U> static U a(z*) {}
45 static void a(long) {}
46 static void a(void *) {}
47 static void a() {
48 void (*p0)(void*) = z().a;
49 p0(0);
50 void (*p1)(long) = a;
51 p1(0);
52 void (*p2)() = a;
53 p2();
54 void (*p3)(z*) = a;
55 p3(0);
56 }
57 };
58
59 int main(int argc, char *argv[]) {
60 if (argc > 1) {
61 x<void>().a();
62 z().a();
63 }
64 }