mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-25 22:38:56 -04:00

An attempt to use dynamic_cast while rtti is disabled, used to emit the error: cannot use dynamic_cast with -fno-rtti and a similar one for typeid. This patch changes that to: use of dynamic_cast requires -frtti Differential Revision: https://reviews.llvm.org/D47291 llvm-svn: 334153
30 lines
483 B
C++
30 lines
483 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify -fno-rtti %s
|
|
|
|
namespace std {
|
|
class type_info;
|
|
}
|
|
|
|
void f()
|
|
{
|
|
(void)typeid(int); // expected-error {{use of typeid requires -frtti}}
|
|
}
|
|
|
|
namespace {
|
|
struct A {
|
|
virtual ~A(){};
|
|
};
|
|
|
|
struct B : public A {
|
|
B() : A() {}
|
|
};
|
|
}
|
|
|
|
bool isa_B(A *a) {
|
|
return dynamic_cast<B *>(a) != 0; // expected-error {{use of dynamic_cast requires -frtti}}
|
|
}
|
|
|
|
void* getMostDerived(A* a) {
|
|
// This cast does not use RTTI.
|
|
return dynamic_cast<void *>(a);
|
|
}
|