27 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// Make sure the TEST_HAS_NO_RTTI macro is defined when the no-rtti Lit feature10// is defined.11 12// REQUIRES: no-rtti13 14#include "test_macros.h"15 16#ifndef TEST_HAS_NO_RTTI17# error "TEST_HAS_NO_RTTI should be defined"18#endif19 20struct A { virtual ~A() { } };21struct B : A { };22 23void f() {24 A* ptr = new B;25 (void)dynamic_cast<B*>(ptr); // expected-error{{use of dynamic_cast requires -frtti}}26}27