Clang Project

clang_source_code/test/SemaCXX/null-cast.cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3struct A {};
4struct B : virtual A {};
5
6void foo() {
7  (void)static_cast<A&>(*(B *)0); // expected-warning {{binding dereferenced null pointer to reference has undefined behavior}}
8}
9