p1.cpp revision 96a914a50cb8c01be8a3b7481cc4791e19c4285b
1// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
2
3namespace test0 {
4  struct A {
5    A() = default;
6    int x;
7    int y;
8
9    A(const A&) = delete; // expected-note {{function has been explicitly marked deleted here}}
10  };
11
12  void foo(...);
13
14  void test() {
15    A a;
16    foo(a); // expected-error {{call to deleted constructor of 'test0::A'}}
17  }
18}
19
20namespace test1 {
21  struct A {
22    A() = default;
23    int x;
24    int y;
25
26  private:
27    A(const A&) = default; // expected-note {{declared private here}}
28  };
29
30  void foo(...);
31
32  void test() {
33    A a;
34    // FIXME: this error about variadics is bogus
35    foo(a); // expected-error {{calling a private constructor of class 'test1::A'}} expected-error {{cannot pass object of non-trivial type 'test1::A' through variadic function}}
36  }
37}
38
39// Don't enforce this in an unevaluated context.
40namespace test2 {
41  struct A {
42    A(const A&) = delete; // expected-note {{marked deleted here}}
43  };
44
45  typedef char one[1];
46  typedef char two[2];
47
48  one &meta(bool);
49  two &meta(...);
50
51  void a(A &a) {
52    char check[sizeof(meta(a)) == 2 ? 1 : -1];
53  }
54
55  void b(A &a) {
56    meta(a); // expected-error {{call to deleted constructor}}
57  }
58}
59