p7-0x.cpp revision 1a6c43a9d215697dbe0418c145a6bd1c85ec654d
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2
3struct X1 {
4  X1();
5};
6
7struct X2 {
8  X2();
9  ~X2();
10};
11
12struct X3 {
13  X3(const X3&) = default;
14};
15
16struct X4 {
17  X4(const X4&) = default;
18  X4(X4&);
19};
20
21void vararg(...);
22
23void f(X1 x1, X2 x2, X3 x3, X4 x4) {
24  vararg(x1); // OK
25  vararg(x2); // expected-error{{cannot pass object of non-trivial type 'X2' through variadic function; call will abort at runtime}}
26  vararg(x3); // OK
27  vararg(x4); // expected-error{{cannot pass object of non-trivial type 'X4' through variadic function; call will abort at runtime}}
28}
29
30
31namespace PR11131 {
32  struct S;
33
34  S &getS();
35
36  void f(...);
37
38  void g() {
39    (void)sizeof(f(getS()));
40  }
41}
42