Open
Description
A post on C++'s std-proposals said some clearly UB code did not trigger a sanitizer failure, which was somewhat confusion, but after investigating it's a regression since clang 20.
#include <typeinfo>
struct Foo {
virtual ~Foo(){}
};
struct Bar {
virtual ~Bar(){}
};
struct Subclass : Bar {};
int main(int arc, char**) {
Foo f;
Bar *b = reinterpret_cast<Bar*>(&f);
(void)typeid(*b);
(void)dynamic_cast<Subclass*>(b);
return 0;
}
Compiling with -fsanitize=undefined
and running reports errors for the dynamic_cast and the typeid in 20, but is silent in trunk