Parameter pack in non-last position in function formal parameter list?

Marc Glisse marc.glisse@inria.fr
Fri Jun 19 16:31:00 GMT 2015


On Fri, 19 Jun 2015, Avi Kivity wrote:

> Consider
>
>  template <typename... X, typename Y>
>  void f(X... x, Y y) {
>  }
>
>
>  int main(int ac, char** av) {
>    f(1, 2, 3, 4);
>    return 0;
>  }
>
> is this legal?

No.

> So it's not complaining that f() is illegal, yet it id not deducing X... as 
> int, int, int.

That's what the standard says. You can still call it as:
f<int,int,int>(1, 2, 3, 4);

(the question is not specific to gcc, so it would be more appropriate on a 
general C++ forum like stackoverflow.com)

-- 
Marc Glisse



More information about the Gcc-help mailing list