Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes and
data members for deleted or user-provided destructors.
Now it's computed in advance, serialize it, and in passing fix all the other
record DefinitionData flags whose serialization was missing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151441 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/PCH/cxx0x-default-delete.cpp b/test/PCH/cxx0x-default-delete.cpp
index 3ecb19c..6eb65d6 100644
--- a/test/PCH/cxx0x-default-delete.cpp
+++ b/test/PCH/cxx0x-default-delete.cpp
@@ -12,6 +12,14 @@
void bar() = delete; // expected-note{{deleted here}}
};
+struct baz {
+ ~baz() = delete; // expected-note{{deleted here}}
+};
+
+class quux {
+ ~quux() = default; // expected-note{{private here}}
+};
+
#else
foo::foo() { } // expected-error{{definition of explicitly defaulted default constructor}}
@@ -20,4 +28,7 @@
f.bar(); // expected-error{{deleted function}}
}
+baz bz; // expected-error{{deleted function}}
+quux qx; // expected-error{{private destructor}}
+
#endif
diff --git a/test/PCH/cxx11-constexpr.cpp b/test/PCH/cxx11-constexpr.cpp
new file mode 100644
index 0000000..338543e
--- /dev/null
+++ b/test/PCH/cxx11-constexpr.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t
+// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
+
+#ifndef HEADER_INCLUDED
+
+#define HEADER_INCLUDED
+
+struct B {
+ B(); // expected-note {{here}}
+ constexpr B(char) {}
+};
+
+struct C { // expected-note {{not an aggregate and has no constexpr constructors}}
+ B b;
+ double d = 0.0;
+};
+
+struct D : B {
+ constexpr D(int n) : B('x'), k(2*n+1) {}
+ int k;
+};
+
+#else
+
+static_assert(D(4).k == 9, "");
+constexpr int f(C c) { return 0; } // expected-error {{not a literal type}}
+constexpr B b; // expected-error {{constant expression}} expected-note {{non-constexpr}}
+
+#endif