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

2024-04-18


777. Default arguments and parameter packs

Section: 9.3.4.7  [dcl.fct.default]     Status: CD2     Submitter: Michael Wong     Date: 13 February, 2009

[Voted into WP at March, 2010 meeting.]

9.3.4.7 [dcl.fct.default] paragraph 4 says,

In a given function declaration, all parameters subsequent to a parameter with a default argument shall have default arguments supplied in this or previous declarations.

It is not clear whether this applies to parameter packs or not. For example, is the following well-formed?

    template <typename... T> void f(int i = 0, T ...args) { }

Note for comparison the corresponding wording in 13.2 [temp.param] paragraph 11 regarding template parameter packs:

If a template-parameter of a class template has a default template-argument, each subsequent template-parameter shall either have a default template-argument supplied or be a template parameter pack.

Proposed resolution (October, 2009):

Change 9.3.4.7 [dcl.fct.default] paragraph 4:

...In a given function declaration, all each parameters subsequent to a parameter with a default argument shall have a default arguments supplied in this or a previous declarations or shall be a function parameter pack. A default argument...