[clang++] if-contexpr expression aren't parsed in an immediate function context (original) (raw)

Sorry for all of these similar bugs! Just filing for now to document; I may have time to help with some PRs in a few weeks.

https://godbolt.org/z/5ejE5f1vK

The "condition of a constexpr if statement" is one of the forms that constitute a manifestly constant-evaluated expression. Since subexpressions of manifestly constant-evaluated expressions are considered to be within an immediate function context, the immediate-escalating expression &fn should be valid and allowed.

We might consider pushing an ExpressionEvaluationContext here when CK == ConditionKind::ConstexprIf, just prior to calling ParseExpression().