You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[expr.prim.req.nested]p2: "A local parameter shall only appear as an unevaluated operand (7.2) within the constraint-expression."
This allows requires (T a) { requires sizeof(a) == 4; } but does not allow requires (T a) { requires sizeof(f(a)) == 4; }, because the term "unevaluated operand" only applies to the immediate operand of various contexts. I believe the intent here is "An unqualified-id naming a local parameter shall not be potentially evaluated." or similar.
The text was updated successfully, but these errors were encountered:
[expr.prim.req.general]p2: "Expressions appearing within a requirement-body are unevaluated operands (7.2)."
Taken literally that would presumably transitively cover all expressions lexically within a requirement-body, allowing requires (int n) { array<int, n>(); }, because n here would be an unevaluated operand.
Even if we interpret this to only apply at the top level and not transitively (which I assume was the intent), this also breaks [expr.prim.req.nested]p2: requires (bool b) { requires b; } is apparently valid, because (the second occurrence of) b here is an unevaluated operand per [expr.prim.req.general]p2 and hence is permitted by [expr.prim.req.nested]p2.
I think we need an explicit list of the places that are treated as unevaluated operands: I think the expression in a simple-requirement or compound-requirement should be, and expressions appearing elsewhere in a requires-expression should receive no special treatment.
This allows
requires (T a) { requires sizeof(a) == 4; }
but does not allowrequires (T a) { requires sizeof(f(a)) == 4; }
, because the term "unevaluated operand" only applies to the immediate operand of various contexts. I believe the intent here is "An unqualified-id naming a local parameter shall not be potentially evaluated." or similar.The text was updated successfully, but these errors were encountered: