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

2024-12-19


1388. Missing non-deduced context following a function parameter pack

Section: 13.10.3.2  [temp.deduct.call]     Status: CD3     Submitter: James Widman     Date: 2011-09-02

[Moved to DR at the October, 2012 meeting.]

Presumably 13.10.3.6 [temp.deduct.type] paragraph 5 should include a bullet for a function parameter or function parameter pack that follows a function parameter pack.

Proposed resolution (February, 2012):

Change 13.10.3.2 [temp.deduct.call] paragraph 1 as follows:

...For a function parameter pack that does not occur at the end of the parameter-declaration-list, the type of the parameter pack is a non-deduced context. When a function parameter pack appears in a non-deduced context (13.10.3.6 [temp.deduct.type]), the type of that parameter pack is never deduced. [Example:

  template<class ... Types> void f(Types& ...);
  template<class T1, class ... Types> void g(T1, Types ...);
  template<class T1, class ... Types> void g1(Types ..., T1);

  void h(int x, float& y) {
    const int z = x;
    f(x, y, z);                  // Types is deduced to int, float, const int
    g(x, y, z);                  // T1 is deduced to int; Types is deduced to float, int
    g1(x, y, z);                 // error: Types is not deduced
    g1<int, int, int>(x, y, z);  // OK, no deduction occurs
  }

end example]

This resolution also resolves issue 1399.