]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/vararg-non-pod.cpp
Update clang to 84175.
[FreeBSD/FreeBSD.git] / test / SemaCXX / vararg-non-pod.cpp
1 // RUN: clang-cc -fsyntax-only -verify -fblocks %s
2
3 extern char version[];
4
5 class C {
6 public:
7   C(int);
8   void g(int a, ...);
9   static void h(int a, ...);
10 };
11
12 void g(int a, ...);
13
14 void t1()
15 {
16   C c(10);
17   
18   g(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic function; call will abort at runtime}}
19   g(10, version);
20 }
21
22 void t2()
23 {
24   C c(10);
25
26   c.g(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic method; call will abort at runtime}}
27   c.g(10, version);
28   
29   C::h(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic function; call will abort at runtime}}
30   C::h(10, version);
31 }
32
33 int (^block)(int, ...);
34
35 void t3()
36 {
37   C c(10);
38   
39   block(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic block; call will abort at runtime}}
40   block(10, version);
41 }
42
43 class D {
44 public:
45   void operator() (int a, ...);
46 };
47
48 void t4()
49 {
50   C c(10);
51
52   D d;
53   
54   d(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic method; call will abort at runtime}}
55   d(10, version);
56 }
57
58 class E {
59   E(int, ...);
60 };
61
62 void t5()
63 {
64   C c(10);
65   
66   E e(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}}
67   (void)E(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}}
68 }