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