blob: efac4cbd1e3a49a54a327bc755a2f5e6e8a444d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// PR c++/61020
// { dg-options "-O2" }
// { dg-do run }
#include <typeinfo>
struct Base {
virtual ~Base() { }
};
struct Derived : public Base {
};
int compare(const Base& base)
{
return typeid(base) == typeid(typeid(Derived));
}
int main()
{
Base base;
Derived derived;
if (compare(base)) return 1;
if (compare(derived)) return 2;
return 0;
}
|