summaryrefslogtreecommitdiffstats
path: root/test/PCH
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-25 07:33:38 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-25 07:33:38 +0000
commitdfefb840e36f069286ef6cf178ef339c90f4603d (patch)
tree5f46ebc9ab35039db1204c9e55202f9594c69b68 /test/PCH
parentf5cd5cc9a7ec114ef1a4c08491a37d2327697c4a (diff)
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
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/cxx0x-default-delete.cpp11
-rw-r--r--test/PCH/cxx11-constexpr.cpp29
2 files changed, 40 insertions, 0 deletions
diff --git a/test/PCH/cxx0x-default-delete.cpp b/test/PCH/cxx0x-default-delete.cpp
index 3ecb19c295..6eb65d61df 100644
--- a/test/PCH/cxx0x-default-delete.cpp
+++ b/test/PCH/cxx0x-default-delete.cpp
@@ -12,6 +12,14 @@ struct foo {
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 @@ void fn() {
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 0000000000..338543ecf9
--- /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