Debian Codegraph @

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

raw
1 // Test that the typeid name for a local class is properly null-terminated.
2 // { dg-do run }
3
4 #include <string.h>
5 #include <typeinfo>
6 #include <stdio.h>
7
8 int f()
9 {
10 struct A {}; struct B {};
11 const std::type_info &ti = typeid(A);
12 const std::type_info &ti2 = typeid(B);
13 puts (ti.name());
14 puts (ti2.name());
15 return strcmp (ti.name(), "Z1fvE1A") || strcmp (ti2.name(), "Z1fvE1B");
16 }
17
18 int main()
19 {
20 return f();
21 }