1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // "support/test_macros.hpp"
11
12 // #define TEST_HAS_NO_RTTI
13
14 #include "test_macros.h"
15
~AA16 struct A { virtual ~A() {} };
17 struct B : A {};
18
main()19 int main() {
20 #if defined(TEST_HAS_NO_RTTI)
21 A* ptr = new B;
22 (void)dynamic_cast<B*>(ptr); // expected-error{{cannot use dynamic_cast}}
23 #else
24 A* ptr = new B;
25 (void)dynamic_cast<B*>(ptr);
26 #error RTTI enabled
27 // expected-error@-1{{RTTI enabled}}
28 #endif
29 }
30