Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 1 | // Without PCH |
Richard Smith | 9ca5c42 | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include %s %s |
Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 3 | // With PCH |
Richard Smith | 9ca5c42 | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 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 |
Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 6 | |
| 7 | #ifndef PASS1 |
| 8 | #define PASS1 |
| 9 | |
| 10 | struct foo { |
| 11 | foo() = default; |
Jordan Rose | b13eb8d | 2012-07-11 19:58:23 +0000 | [diff] [blame] | 12 | void bar() = delete; |
Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 13 | }; |
| 14 | |
Richard Smith | 561fb15 | 2012-02-25 07:33:38 +0000 | [diff] [blame] | 15 | struct baz { |
Jordan Rose | b13eb8d | 2012-07-11 19:58:23 +0000 | [diff] [blame] | 16 | ~baz() = delete; |
Richard Smith | 561fb15 | 2012-02-25 07:33:38 +0000 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | class quux { |
Jordan Rose | b13eb8d | 2012-07-11 19:58:23 +0000 | [diff] [blame] | 20 | ~quux() = default; |
Richard Smith | 561fb15 | 2012-02-25 07:33:38 +0000 | [diff] [blame] | 21 | }; |
| 22 | |
Richard Smith | 6b02d46 | 2012-12-08 08:32:28 +0000 | [diff] [blame] | 23 | struct A { |
| 24 | A(const A&) = default; |
| 25 | template<typename T> A(T&&); |
| 26 | }; |
| 27 | |
Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 28 | #else |
| 29 | |
Alexis Hunt | 119c10e | 2011-05-25 23:16:36 +0000 | [diff] [blame] | 30 | foo::foo() { } // expected-error{{definition of explicitly defaulted default constructor}} |
Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 31 | foo f; |
| 32 | void fn() { |
Jordan Rose | b13eb8d | 2012-07-11 19:58:23 +0000 | [diff] [blame] | 33 | f.bar(); // expected-error{{deleted function}} expected-note@12{{deleted here}} |
Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 34 | } |
| 35 | |
Jordan Rose | b13eb8d | 2012-07-11 19:58:23 +0000 | [diff] [blame] | 36 | baz bz; // expected-error{{deleted function}} expected-note@16{{deleted here}} |
| 37 | quux qx; // expected-error{{private destructor}} expected-note@20{{private here}} |
Richard Smith | 561fb15 | 2012-02-25 07:33:38 +0000 | [diff] [blame] | 38 | |
Richard Smith | 6b02d46 | 2012-12-08 08:32:28 +0000 | [diff] [blame] | 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 | |
Alexis Hunt | 94f9cbf | 2011-05-13 01:01:05 +0000 | [diff] [blame] | 46 | #endif |