cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[stmt.if] Declarations cannot be value-dependent #551

Closed Eisenwave closed 3 weeks ago

Eisenwave commented 3 weeks ago

Reference (section label): [stmt.if]

Issue description

[stmt.if] paragraph 2, sentence 3 states:

During the instantiation of an enclosing templated entity ([temp.pre]), if the condition is not value-dependent after its instantiation, the discarded substatement (if any) is not instantiated.

However, the term value-dependent is only defined for expressions, and it is possible that a condition is a declaration.

Suggested resolution

Eisenwave commented 3 weeks ago

Hmm, I think this is actually editorial only; we already have https://eel.is/c++draft/temp.dep.constexpr#2.6