[cxx-abi-dev] Mangling of variadic arguments to alias template

James Widman widman at gimpel.com
Tue Dec 13 15:54:12 UTC 2011


On 12 Dec 2011, at 11:05 PM, Jason Merrill wrote:

> In most cases, an alias template is transparent; when it's used in a template we can just substitute in the dependent template arguments.  So it seems to make sense for it to be transparent to mangling as well. But this doesn't work if the template-id uses a pack expansion for non-variadic parameters.  i.e.
> 
> template<class T, class U, class V>
> struct S {};
> 
> template<class T, class V>
> using A = S<T, int, V>;
> 
> template<class... Ts>
> void foo(A<Ts...>);
> 
> There is no way to express A<Ts...> in terms of S;

If we allow a notation to refer to an element of a pack, we could: alias A has two non-pack parameters so whatever the argument pack, we must expand it to:

  A<Ts at 1, Ts at 2>

And then:

  S<Ts at 1, int, Ts at 2>

If S had default arguments, they would be considered long before we got to the point of deduction against foo() (so we will never consider an argument type to this foo() that has anything other than 3 arguments to S).

James Widman  
-- 
Gimpel Software 
http://gimpel.com






More information about the cxx-abi-dev mailing list