summaryrefslogtreecommitdiff
path: root/test/PCH/chain-invalid-code.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/PCH/chain-invalid-code.cpp')
-rw-r--r--test/PCH/chain-invalid-code.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/PCH/chain-invalid-code.cpp b/test/PCH/chain-invalid-code.cpp
new file mode 100644
index 000000000000..9de88f0cee77
--- /dev/null
+++ b/test/PCH/chain-invalid-code.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only %s -chain-include %s -Wuninitialized -Wunused -verify
+
+// Make sure there is no crash.
+
+#ifndef HEADER
+#define HEADER
+
+#include "non-existent-header.h"
+
+class A {
+public:
+ ~A();
+};
+
+class ForwardCls;
+struct B {
+ ForwardCls f;
+ A a;
+};
+
+#else
+
+static void test() {
+ int x; // expected-warning {{unused}}
+ B b;
+}
+
+#endif