[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / cxx0x-default-delete.cpp
blobbca4607d33a79f929e4adc53fb9f30e0b57e8fcc
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
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
10 #ifndef PASS1
11 #define PASS1
13 struct foo {
14 foo() = default;
15 void bar() = delete;
18 struct baz {
19 ~baz() = delete;
22 class quux {
23 ~quux() = default;
26 struct A {
27 A(const A&) = default;
28 template<typename T> A(T&&);
31 #else
33 foo::foo() { } // expected-error{{definition of explicitly defaulted default constructor}}
34 foo f;
35 void fn() {
36 f.bar(); // expected-error{{deleted function}} expected-note@15{{deleted here}}
39 baz bz; // expected-error{{deleted function}} expected-note@19{{deleted here}}
40 quux qx; // expected-error{{private destructor}} expected-note@23{{private here}}
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&&), "");
49 #endif