| 1 | // Without PCH |
| 2 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include %s %s |
| 3 | // With PCH |
| 4 | // RUN: %clang_cc1 -x c++-header -std=c++11 -emit-pch -o %t %s |
| 5 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include-pch %t %s |
| 6 | |
| 7 | #ifndef PASS1 |
| 8 | #define PASS1 |
| 9 | |
| 10 | struct foo { |
| 11 | foo() = default; |
| 12 | void bar() = delete; |
| 13 | }; |
| 14 | |
| 15 | struct baz { |
| 16 | ~baz() = delete; |
| 17 | }; |
| 18 | |
| 19 | class quux { |
| 20 | ~quux() = default; |
| 21 | }; |
| 22 | |
| 23 | struct A { |
| 24 | A(const A&) = default; |
| 25 | template<typename T> A(T&&); |
| 26 | }; |
| 27 | |
| 28 | #else |
| 29 | |
| 30 | foo::foo() { } // expected-error{{definition of explicitly defaulted default constructor}} |
| 31 | foo f; |
| 32 | void fn() { |
| 33 | f.bar(); // expected-error{{deleted function}} expected-note@12{{deleted here}} |
| 34 | } |
| 35 | |
| 36 | baz bz; // expected-error{{deleted function}} expected-note@16{{deleted here}} |
| 37 | quux qx; // expected-error{{private destructor}} expected-note@20{{private here}} |
| 38 | |
| 39 | struct B { A a; }; |
| 40 | struct C { mutable A a; }; |
| 41 | static_assert(__is_trivially_constructible(B, const B&), ""); |
| 42 | static_assert(!__is_trivially_constructible(B, B&&), ""); |
| 43 | static_assert(!__is_trivially_constructible(C, const C&), ""); |
| 44 | static_assert(!__is_trivially_constructible(C, C&&), ""); |
| 45 | |
| 46 | #endif |
| 47 | |