]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CXX/expr/expr.post/expr.call/p7-0x.cpp
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / CXX / expr / expr.post / expr.call / p7-0x.cpp
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2
3 struct X1 {
4   X1();
5 };
6
7 struct X2 {
8   X2();
9   ~X2();
10 };
11
12 struct X3 {
13   X3(const X3&) = default;
14 };
15
16 struct X4 {
17   X4(const X4&) = default;
18   X4(X4&);
19 };
20
21 void vararg(...);
22
23 void g();
24
25 void f(X1 x1, X2 x2, X3 x3, X4 x4) {
26   vararg(x1); // OK
27   vararg(x2); // expected-error{{cannot pass object of non-trivial type 'X2' through variadic function; call will abort at runtime}}
28   vararg(x3); // OK
29   vararg(x4); // expected-error{{cannot pass object of non-trivial type 'X4' through variadic function; call will abort at runtime}}
30
31   vararg(g()); // expected-error{{cannot pass expression of type 'void' to variadic function}}
32   vararg({1, 2, 3}); // expected-error{{cannot pass initializer list to variadic function}}
33 }
34
35
36 namespace PR11131 {
37   struct S;
38
39   S &getS();
40
41   int f(...);
42
43   void g() {
44     (void)sizeof(f(getS()));
45   }
46 }