Here is a testcase: #include <typeinfo> int const volatile v5[10] = {0}; int main (int argc, char **argv) { const std::type_info& t = typeid (::v5); }
According to Itanium C++ ABI, the mangled name of typeid(::v5) should follow the following grammer rules: <mangled-name> ::= _Z <encoding> <encoding> ::= <special-name> <special-name> ::= TI <type> # typeinfo structure <type> ::= <array-type> <array-type> ::= A <positive dimension number> _ <element type> To my understanding, the element type follows the <type> rule and is used to encode the type of variable v5[10]: <type> ::= <CV-qualifiers> <type> <CV-qualifiers> ::= [r] [V] [K] # restrict (C99), volatile, const So the mangled name should be: __ZTIA10_VKi. But using gcc 4.0 compiler, I am getting "__ZTIA10_i" mangled name instead. Please verify the problem, thanks. -- Summary: mangled name of typeid doesn't encode cv-qualifer. Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: yanliu at ca dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20123