mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:16:37 +00:00

We were leaving the SubobjectDesignator in a surprising situation, where it was allegedly valid but didn't actually refer to a type. This caused a crash later on. This patch fills out the SubobjectDesignator with the pointee type (as happens in other evaluations of constant pointers) so that we don't crash later. llvm-svn: 303957
9 lines
227 B
C++
9 lines
227 B
C++
// 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}}
|
|
}
|