1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// Make sure the TEST_HAS_NO_RTTI macro is NOT defined when the no-rtti Lit
10// feature isn't defined.
11
12// UNSUPPORTED: no-rtti
13
14#include "test_macros.h"
15
16#ifdef TEST_HAS_NO_RTTI
17# error "TEST_HAS_NO_RTTI should NOT be defined"
18#endif
19
20struct A { virtual ~A() { } };
21struct B : A { };
22
23int main(int, char**) {
24 A* ptr = new B;
25 (void)dynamic_cast<B*>(ptr);
26 delete ptr;
27 return 0;
28}
29

source code of libcxx/test/support/test.support/test_macros_header.rtti.pass.cpp