See attached test case.
Created attachment 15531 [details] Test case.
Confirmed. The demangler gets a valid symbol it can't demangle. W.
By the way, the return code of __cxa_demangle is -2: mangled_name is not a valid name under the C++ ABI mangling rules. as per http://docs.mandragor.org/files/Programming_languages/Cpp/libstdcpp_v3_Source_Documentation/namespaceabi.html The string that can't be demangled is "3barILZ3bazEE". W.
This is expected, we should not be demangling types with __cxa_demangle.
Ok, this is a generic demangler issue, we don't demangle _Z1f3barILZ3bazEE either. Which is f(bar<baz>) but only because it is mangled incorrectly in the first place. So the real issue here is that the demangle only handles correctly mangled names. _Z1f3barIL_Z3bazEE is the correct mangling.
so all three versions mangle it differently if we have f(bar<baz>) 1: _Z1f3barIXadL_Z3bazEEE 2: _Z1f3barILZ3bazEE 3: _Z1f3barIL_Z3bazEE I think 3 is correct as the underscore is needed and the address is not supplied.. but the default value is 2 right now I don't know if we should "fix" up the mangler to accept version 2 at all.
See bug #16240 for some background.
As mentioned in the other bug report, it is hard to handle the -fabi-version=2 version of the mangled string. We handle correctly the correctly mangled already. So closing as won't fix.