blob: 230f6a61471569521fd7a6bf63763ede316d03da [file] [log] [blame]
Alexis Hunt94f9cbf2011-05-13 01:01:05 +00001// Without PCH
Richard Smith9ca5c422011-10-13 22:29:44 +00002// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include %s %s
Alexis Hunt94f9cbf2011-05-13 01:01:05 +00003// With PCH
Richard Smith9ca5c422011-10-13 22:29:44 +00004// 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 Hunt94f9cbf2011-05-13 01:01:05 +00006
7#ifndef PASS1
8#define PASS1
9
10struct foo {
11 foo() = default;
Jordan Roseb13eb8d2012-07-11 19:58:23 +000012 void bar() = delete;
Alexis Hunt94f9cbf2011-05-13 01:01:05 +000013};
14
Richard Smith561fb152012-02-25 07:33:38 +000015struct baz {
Jordan Roseb13eb8d2012-07-11 19:58:23 +000016 ~baz() = delete;
Richard Smith561fb152012-02-25 07:33:38 +000017};
18
19class quux {
Jordan Roseb13eb8d2012-07-11 19:58:23 +000020 ~quux() = default;
Richard Smith561fb152012-02-25 07:33:38 +000021};
22
Richard Smith6b02d462012-12-08 08:32:28 +000023struct A {
24 A(const A&) = default;
25 template<typename T> A(T&&);
26};
27
Alexis Hunt94f9cbf2011-05-13 01:01:05 +000028#else
29
Alexis Hunt119c10e2011-05-25 23:16:36 +000030foo::foo() { } // expected-error{{definition of explicitly defaulted default constructor}}
Alexis Hunt94f9cbf2011-05-13 01:01:05 +000031foo f;
32void fn() {
Jordan Roseb13eb8d2012-07-11 19:58:23 +000033 f.bar(); // expected-error{{deleted function}} expected-note@12{{deleted here}}
Alexis Hunt94f9cbf2011-05-13 01:01:05 +000034}
35
Jordan Roseb13eb8d2012-07-11 19:58:23 +000036baz bz; // expected-error{{deleted function}} expected-note@16{{deleted here}}
37quux qx; // expected-error{{private destructor}} expected-note@20{{private here}}
Richard Smith561fb152012-02-25 07:33:38 +000038
Richard Smith6b02d462012-12-08 08:32:28 +000039struct B { A a; };
40struct C { mutable A a; };
41static_assert(__is_trivially_constructible(B, const B&), "");
42static_assert(!__is_trivially_constructible(B, B&&), "");
43static_assert(!__is_trivially_constructible(C, const C&), "");
44static_assert(!__is_trivially_constructible(C, C&&), "");
45
Alexis Hunt94f9cbf2011-05-13 01:01:05 +000046#endif