
According to the C++ standard, `dynamic_cast` of pointers either returns a pointer (7.6.1.7) or results in undefined behavior (11.9.5). This patch marks `__dynamic_cast` as `willreturn` to remove unused calls. Fixes #77606.
9 lines
273 B
C++
9 lines
273 B
C++
// RUN: %clang_cc1 -I%S %s -O3 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -std=c++11 -o - | FileCheck %s
|
|
struct A { virtual ~A(); };
|
|
struct B : A { };
|
|
|
|
void foo(A* a) {
|
|
// CHECK-NOT: call {{.*}} @__dynamic_cast
|
|
B* b = dynamic_cast<B*>(a);
|
|
}
|