Mangling of template parameter packs

Jason Merrill jason at redhat.com
Fri Sep 5 17:26:30 UTC 2008


While I was looking at the decltype mangling issues, I noticed that the 
mangling for parameter packs seems odd.  For instance, given

template<typename... T>
int f(T...);
int i = f();

we get

_Z1fIEiDpT_

which has no template arguments, but the function parameter type wants 
to refer to the first one.

I think it would be better for a parameter pack to be mangled as a 
nested template argument list, i.e.

_Z1fIIEEiDpT_

and then T_ refers to the inner (empty) template argument list, rather 
than a non-existent template argument.

G++ 4.3 has already been released with variadic template support, but it 
still uses U10variadic for pack expansions, so there will be a binary 
compatibility issue regardless of this change.

Jason



More information about the cxx-abi-dev mailing list