This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


2395. Parameters following a pack expansion

Section: 13.2  [temp.param]     Status: drafting     Submitter: Richard Smith     Date: 2018-12-03

The Standard is not clear, and there is implementation divergence, for an example like the following:

  template<class ...Types> struct Tuple_ { // _VARIADIC_TEMPLATE 
    template<Types ...T, int I> int f() {
      return sizeof...(Types);
    }
  };
  int main() {
    Tuple_<char,int> a;
    int b = a.f<1, 2, 3>();
  }

The question is whether the 3 is accepted as the argument for I or an error, exceeding the number of arguments for T, which is set as 2 by the template arguments for Tuple_. See also issue 2383 for a related example.