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