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