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

John Spicer jhs at edg.com
Tue Dec 13 18:31:53 UTC 2011


[ I originally sent this reply just to Jason by mistake.   I'm resending it to the list now.  Since my original message Jason has taken this to the WG21 core reflector ]


On Dec 12, 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; we need to wait until we have the argument pack before we can assign individual arguments to parameters.
> 
> So what do we want to do about this?  Mangle alias-templates only in this situation?
> 

I think the answer should just be "you can't do that".   Aliases have to be expanded immediately, and if you can't do so it should be an error.

For this example, we currently say:

"t1.c", line 8: error: too few arguments for alias template "A"
  void foo(A<Ts...>);
                  ^

John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20111213/9148dafd/attachment-0001.html>


More information about the cxx-abi-dev mailing list