Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/opt/typeinfo1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // PR c++/61020 |
2 // { dg-options "-O2" } | |
3 // { dg-do run } | |
4 | |
5 #include <typeinfo> | |
6 | |
7 struct Base { | |
8 virtual ~Base() { } | |
9 }; | |
10 | |
11 struct Derived : public Base { | |
12 }; | |
13 | |
14 int compare(const Base& base) | |
15 { | |
16 return typeid(base) == typeid(typeid(Derived)); | |
17 } | |
18 | |
19 int main() | |
20 { | |
21 Base base; | |
22 Derived derived; | |
23 | |
24 if (compare(base)) return 1; | |
25 if (compare(derived)) return 2; | |
26 return 0; | |
27 } |