[backport gcc-4.7/trunk r179236 ] From: "Marcus Shawcroft" Subject: [PATCH, LIBSTDC++] Fix type_info equivalence test. Date: Tue, 9 Nov 2010 10:43:21 -0000 List-Archive: Hi, The attached patch fixes the failure of g++.dg/abi/local1.C observed on ARM linux-gnueabi. The type_info::operator== implementation obtains the type names for comparison by calling name(). The implementation of name() strips the leading '*' prefix if present. The '*' prefix marker is emitted by gcc to force a pointer comparison. This patch replaces relevant name() call with a direct reference to __name to ensure the prefix if any is visible. Ok? libstdc++-v3/ 2011-09-27 Marcus Shawcroft * libsupc++/tinfo.cc (type_info::operator==): Test __name instead of name(). --- gcc-4.6.2/libstdc++-v3/libsupc++/tinfo.cc.~1~ 2009-10-30 23:23:59.000000000 +0100 +++ gcc-4.6.2/libstdc++-v3/libsupc++/tinfo.cc 2011-12-26 23:54:55.000000000 +0100 @@ -41,8 +41,11 @@ operator== (const std::type_info& arg) c #if __GXX_MERGED_TYPEINFO_NAMES return name () == arg.name (); #else + /* The name() method will strip any leading '*' prefix. Therefore + take care to look at __name rather than name() when looking for + the "pointer" prefix. */ return (&arg == this) - || (name ()[0] != '*' && (__builtin_strcmp (name (), arg.name ()) == 0)); + || (__name[0] != '*' && (__builtin_strcmp (name (), arg.name ()) == 0)); #endif }