Anders Carlsson | 906fed0 | 2009-01-13 05:48:52 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify -fblocks %s |
| 2 | |
| 3 | class C { |
| 4 | public: |
| 5 | C(int); |
| 6 | void g(int a, ...); |
| 7 | static void h(int a, ...); |
| 8 | }; |
| 9 | |
| 10 | void g(int a, ...); |
| 11 | |
| 12 | void t1() |
| 13 | { |
| 14 | C c(10); |
| 15 | |
| 16 | g(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic function; call will abort at runtime}} |
| 17 | } |
| 18 | |
| 19 | void t2() |
| 20 | { |
| 21 | C c(10); |
| 22 | |
| 23 | c.g(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic method; call will abort at runtime}} |
| 24 | |
| 25 | C::h(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic function; call will abort at runtime}} |
| 26 | } |
| 27 | |
| 28 | int (^block)(int, ...); |
| 29 | |
| 30 | void t3() |
| 31 | { |
| 32 | C c(10); |
| 33 | |
| 34 | block(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic block; call will abort at runtime}} |
| 35 | } |
| 36 | |
| 37 | class D { |
| 38 | public: |
| 39 | void operator() (int a, ...); |
| 40 | }; |
| 41 | |
| 42 | void t4() |
| 43 | { |
| 44 | C c(10); |
| 45 | |
| 46 | D d; |
| 47 | |
| 48 | d(10, c); // expected-warning{{Line 48: cannot pass object of non-POD type 'class C' through variadic method; call will abort at runtime}} |
| 49 | } |