Nico Weber | 11d1a69 | 2012-05-20 01:27:21 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -fno-rtti %s |
| 2 | |
| 3 | namespace std { |
| 4 | class type_info; |
| 5 | } |
| 6 | |
| 7 | void f() |
| 8 | { |
| 9 | (void)typeid(int); // expected-error {{cannot use typeid with -fno-rtti}} |
| 10 | } |
Arnaud A. de Grandmaison | 789d82a | 2013-08-01 08:28:32 +0000 | [diff] [blame] | 11 | |
| 12 | namespace { |
| 13 | struct A { |
| 14 | virtual ~A(){}; |
| 15 | }; |
| 16 | |
| 17 | struct B : public A { |
| 18 | B() : A() {} |
| 19 | }; |
| 20 | } |
| 21 | |
| 22 | bool isa_B(A *a) { |
| 23 | return dynamic_cast<B *>(a) != 0; // expected-error {{cannot use dynamic_cast with -fno-rtti}} |
| 24 | } |
Eli Friedman | 01ae093 | 2013-09-24 23:21:41 +0000 | [diff] [blame] | 25 | |
| 26 | void* getMostDerived(A* a) { |
| 27 | // This cast does not use RTTI. |
| 28 | return dynamic_cast<void *>(a); |
| 29 | } |