Pack expansion into fixed alias template parameter list
13.7.8 [temp.alias]
Jason Merrill

Created on 2011-12-13.00:00:00 last changed 12 months ago


Date: 2022-11-20.07:54:16

CWG 2022-11-11

There is no more implementation divergence; all known implementations reject the example.

Date: 2013-05-03.00:00:00

Additional note, April, 2013:

For another example, consider:

  template<class... x> class list{};
  template<class a, class... b> using tail=list<b...>;
  template <class...T> void f(tail<T...>);

  int main() {

There is implementation variance in the handling of this example.

Date: 2012-10-15.00:00:00

Notes from the October, 2012 meeting:

The consensus of CWG was that this usage should be prohibited, disallowing use of an alias template when a dependent argument can't simply be substituted directly into the type-id.

Date: 2012-11-03.00:00:00

Originally, a pack expansion could not expand into a fixed-length template parameter list, but this was changed in N2555. This works fine for most templates, but causes issues with alias templates.

In most cases, an alias template is transparent; when it's used in a template we can just substitute in the dependent template arguments. But this doesn't work if the template-id uses a pack expansion for non-variadic parameters. For example:

    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, so we need to hold onto the A until we have the Ts to substitute in, and therefore it needs to be handled in mangling.

Currently, EDG and Clang reject this testcase, complaining about too few template arguments for A. G++ did as well, but I thought that was a bug. However, on the ABI list John Spicer argued that it should be rejected.

(See also issue 1558.)

Date User Action Args
2022-11-20 07:54:16adminsetmessages: + msg7032
2022-02-18 07:47:23adminsetstatus: drafting -> open
2013-05-03 00:00:00adminsetmessages: + msg4349
2012-11-03 00:00:00adminsetmessages: + msg4105
2012-11-03 00:00:00adminsetstatus: open -> drafting
2011-12-13 00:00:00admincreate