[cxx-abi-dev] missing mangling for <template-param> <template-args> in <unresolved-name>

Richard Smith richardsmith at google.com
Wed Feb 18 19:46:37 UTC 2015


Consider these two cases:

template<typename T> struct X { struct Y {}; };

template<template<typename> class U> decltype(X<int>().~U<int>()) f();
template<template<typename> class U> decltype(X<int>::Y().U<int>::Y::~Y())
g();

Neither of these function templates has a mangling. We get to
<unresolved-name> for the destructor name, and find a template template
parameter with template args, which we cannot mangle as an
<unresolved-type>, and must not mangle as a <simple-id> (because the name
of the template template parameter can change between redeclarations).

Suggested fix: U<int> should be an <unresolved-type>. Replace

  <unresolved-type> ::= <template-param>

with

  <unresolved-type> ::= <template-param> [ <template-args> ]

... which results, I think, in these manglings for f<X> and g<X>:

_Z1fI1XEDTcldtcvS0_IiE_EdnT_IiEEEv
_Z1gI1XEDTcldtcvNS0_IiE1YE_EsrNT_IiE1YEdn1YEEv

(Clang trunk implements this, but gets the g<X> mangling wrong for other
reasons.)

OK?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20150218/ad501e72/attachment.html>


More information about the cxx-abi-dev mailing list