diff options
Diffstat (limited to 'test/SemaCXX/no-rtti.cpp')
-rw-r--r-- | test/SemaCXX/no-rtti.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/SemaCXX/no-rtti.cpp b/test/SemaCXX/no-rtti.cpp index 75167050dca2..a171b3cde2c3 100644 --- a/test/SemaCXX/no-rtti.cpp +++ b/test/SemaCXX/no-rtti.cpp @@ -8,3 +8,22 @@ void f() { (void)typeid(int); // expected-error {{cannot use typeid with -fno-rtti}} } + +namespace { +struct A { + virtual ~A(){}; +}; + +struct B : public A { + B() : A() {} +}; +} + +bool isa_B(A *a) { + return dynamic_cast<B *>(a) != 0; // expected-error {{cannot use dynamic_cast with -fno-rtti}} +} + +void* getMostDerived(A* a) { + // This cast does not use RTTI. + return dynamic_cast<void *>(a); +} |