summaryrefslogtreecommitdiffstats
path: root/clang/test/PCH/chain-invalid-code.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/PCH/chain-invalid-code.cpp')
-rw-r--r--clang/test/PCH/chain-invalid-code.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/PCH/chain-invalid-code.cpp b/clang/test/PCH/chain-invalid-code.cpp
new file mode 100644
index 00000000000..9de88f0cee7
--- /dev/null
+++ b/clang/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
OpenPOWER on IntegriCloud