summaryrefslogtreecommitdiff
path: root/test/SemaCXX/null-cast.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-29 16:25:46 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-29 16:25:46 +0000
commitb5aee35cc5d62f11d98539f62e4fe63f0ac9edc6 (patch)
tree3e6ab962dbc73cfe1445a60d2eb4dfba7c939a22 /test/SemaCXX/null-cast.cpp
parentaa803409c3bd3930126db630c29f63d42f255153 (diff)
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}}
+}