https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90792
Bug ID: 90792 Summary: incorrect mangling for <unresolved-name> beginning with an <unresolved-qualifier-level> Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: richard-gccbugzilla at metafoo dot co.uk Target Milestone: --- Imported from https://llvm.org/PR14117 template<typename From> struct IsConvertible { static const bool value =true; }; template<bool B> struct EnableIf { typedef int Type; }; template <typename S> void Handle(S x, typename EnableIf<IsConvertible<S>::value>::Type dummy) { } template void Handle( int x, typename EnableIf<IsConvertible<int>::value>::Type dummy ); gcc produces _Z6HandleIiEvT_N8EnableIfIXsr13IsConvertibleIS0_E5valueEE4TypeE and clang produces _Z6HandleIiEvT_N8EnableIfIXsr13IsConvertibleIS0_EE5valueEE4TypeE. Per the Itanium ABI, http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.unresolved-name there are two rules that can produce an 'sr' mangling: <unresolved-name> ::= sr <unresolved-type> <base-unresolved-name> ::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name> <unresolved-type> ::= <template-param> [ <template-args> ] ::= <decltype> ::= <substitution> <unresolved-qualifier-level> ::= <simple-id> <simple-id> ::= <source-name> [ <template-args> ] Here, 13IsConvertible is an <unresolved-qualifier-level>, not an <unresolved-type>, so an E must be inserted after the qualifiers even if there's only one of them. The demangler has a matching bug; it can demangle the incorrect mangling but not the correct one.