[cxx-abi-dev] Mangling of template parameter packs

Doug Gregor doug.gregor at gmail.com
Fri Sep 5 20:31:16 UTC 2008


On Fri, Sep 5, 2008 at 1:26 PM, Jason Merrill <jason at redhat.com> wrote:
> 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.

This is much better. Thanks!

> 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.

... and users of GCC's *experimental* C++0x mode have been loudly
warned that details may change. We shouldn't be concerned at all about
this compatibility issue.

  - Doug



More information about the cxx-abi-dev mailing list