Issue 123524
Summary [clang++] if-contexpr _expression_ aren't parsed in an immediate function context
Labels clang
Assignees
Reporter katzdm
    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](https://github.com/llvm/llvm-project/blob/main/clang/lib/Parse/ParseExprCXX.cpp#L2207) when `CK == ConditionKind::ConstexprIf`, just prior to calling `ParseExpression()`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to