[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / ms-no-rtti-data.cpp
blobaef167d8a3736ab8a7374cacbee1057861541607
1 // RUN: %clang_cc1 %s -triple x86_64-windows-msvc -fdiagnostics-format msvc -fno-rtti-data -fsyntax-only -verify
3 namespace std {
4 struct type_info {};
5 } // namespace std
6 class B {
7 public:
8 virtual ~B() = default;
9 };
11 class D1 : public B {
12 public:
13 ~D1() = default;
16 void f() {
17 B *b = new D1();
18 auto d = dynamic_cast<D1 *>(b); // expected-warning{{dynamic_cast will not work since RTTI data is disabled by /GR-}}
19 void *v = dynamic_cast<void *>(b); // expected-warning{{dynamic_cast will not work since RTTI data is disabled by /GR-}}
21 (void)typeid(int);
22 (void)typeid(b);
23 (void)typeid(*b); // expected-warning{{typeid will not work since RTTI data is disabled by /GR-}}
24 B b2 = *b;
25 (void)typeid(b2);
26 (void)typeid(*&b2); // expected-warning{{typeid will not work since RTTI data is disabled by /GR-}}
27 (void)typeid((B &)b2);
29 B &br = b2;
30 (void)typeid(br); // expected-warning{{typeid will not work since RTTI data is disabled by /GR-}}
31 (void)typeid(&br);