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

2023-01-15


1716. When are default arguments evaluated?

Section: 9.3.4.7  [dcl.fct.default]     Status: C++14     Submitter: David Krauss     Date: 2013-07-17

[Moved to DR at the February, 2014 meeting.]

According to 9.3.4.7 [dcl.fct.default] paragraph 9,

Default arguments are evaluated each time the function is called.

Obviously, what was intended by this is that the default argument is evaluated only if no corresponding actual argument is provided, but this could be read as indicating that the default argument is evaluated and discarded by every function call.

Proposed resolution (January, 2014):

Change 9.3.4.7 [dcl.fct.default] paragraph 9 as follows:

Default arguments are A default argument is evaluated each time the function is called with no argument for the corresponding parameter. The order of evaluation...