Title
Local variables in default arguments
Status
cd5
Section
9.3.4.7 [dcl.fct.default]
Submitter
Geoffrey Romer

Created on 2017-04-26.00:00:00 last changed 48 months ago

Messages

Date: 2018-10-15.00:00:00

[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.

History
Date User Action Args
2020-12-15 00:00:00adminsetstatus: dr -> cd5
2018-04-11 00:00:00adminsetstatus: open -> dr
2017-04-26 00:00:00admincreate