Debian Codegraph @

gcc/testsuite/g++.dg/rtti/typeid11.C

raw
1 // { dg-do run }
2
3 #include <typeinfo>
4
5 struct Base { virtual void foo() {} }; // polymorphic
6
7 int main()
8 {
9 Base b;
10 Base *ary[] = { &b, &b, &b};
11
12 int iter = 0;
13 typeid(*ary[iter++]);
14 if (iter != 1) // should be 1
15 __builtin_abort(); // but 2
16 }