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


2346. Local variables in default arguments

Section: 9.3.4.7  [dcl.fct.default]     Status: CD5     Submitter: Geoffrey Romer     Date: 2017-04-26

[Adopted as a DR as part of paper P0588R1 at the October, 2018 meeting.]

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

A local variable shall not appear as a potentially-evaluated expression in a default argument.

This prohibits plausible uses of constexpr and static local variables. Presumably this rule should be similar to the one in 11.6 [class.local] paragraph 1, regarding local classes, which applies to odr-use, not potential evaluation, and to variables with automatic storage duration.