brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 208062a Raw
58 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s2 3namespace test0 {4  struct A {5    A() = default;6    int x;7    int y;8 9    A(const A&) = delete; // expected-note {{'A' 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 '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    foo(a); // expected-error {{calling a private constructor of class 'test1::A'}}35  }36}37 38// Don't enforce this in an unevaluated context.39namespace test2 {40  struct A {41    A(const A&) = delete; // expected-note {{marked deleted here}}42  };43 44  typedef char one[1];45  typedef char two[2];46 47  one &meta(bool);48  two &meta(...);49 50  void a(A &a) {51    char check[sizeof(meta(a)) == 2 ? 1 : -1];52  }53 54  void b(A &a) {55    meta(a); // expected-error {{call to deleted constructor}}56  }57}58