summaryrefslogtreecommitdiff
path: root/test/SemaCXX/null-cast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/null-cast.cpp')
-rw-r--r--test/SemaCXX/null-cast.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/SemaCXX/null-cast.cpp b/test/SemaCXX/null-cast.cpp
new file mode 100644
index 000000000000..c80ab8fced1e
--- /dev/null
+++ b/test/SemaCXX/null-cast.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A {};
+struct B : virtual A {};
+
+void foo() {
+ (void)static_cast<A&>(*(B *)0); // expected-warning {{binding dereferenced null pointer to reference has undefined behavior}}
+}