Multiple ChoiceHard 45s
if constexpr discarded branch syntax
In a template, inside if constexpr(false) { x.member_that_does_not_exist(); } where false is value-dependent, is this ill-formed?
Options
- 1Yes, both branches of every if constexpr are always instantiated and type-checked regardless of the value
- 2No—the discarded statement is not instantiated when value-dependent and false, but it must still be syntactically valid
- 3Yes, unless the discarded branch is additionally wrapped in a preprocessor #if guard that removes it
- 4No—the discarded branch is completely ignored, including its syntax and any invalid member names inside it
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.