Whereas it is UB in terms of the standard to delete an array of objects via pointer whose static type doesn't match its dynamic type, MSVC supports an extension allowing to do it. Aside from array deletion not working correctly in the mentioned case, currently not having this extension implemented causes clang to generate code that is not compatible with the code generated by MSVC, because clang always puts scalar deleting destructor to the vftable. This PR aims to resolve these problems. Fixes https://github.com/llvm/llvm-project/issues/19772
23 lines
622 B
C++
23 lines
622 B
C++
// RUN: %clang_cc1 %s -fno-rtti-data -triple=i386-pc-win32 -o - -emit-llvm | FileCheck %s
|
|
|
|
// vftable shouldn't have RTTI data in it.
|
|
// CHECK-NOT: @"??_R4S@@6B@"
|
|
// CHECK: @"??_7S@@6B@" = linkonce_odr unnamed_addr constant { [1 x ptr] } { [1 x ptr] [ptr @"??_ES@@UAEPAXI@Z"] }, comdat
|
|
|
|
struct type_info;
|
|
namespace std { using ::type_info; }
|
|
|
|
struct S {
|
|
virtual ~S();
|
|
} s;
|
|
|
|
struct U : S {
|
|
virtual ~U();
|
|
};
|
|
|
|
extern S *getS();
|
|
|
|
const std::type_info &ti = typeid(*getS());
|
|
const U &u = dynamic_cast<U &>(*getS());
|
|
// CHECK: call ptr @__RTDynamicCast(ptr %{{.+}}, i32 0, ptr @"??_R0?AUS@@@8", ptr @"??_R0?AUU@@@8", i32 1)
|