Title
Useless restriction on use of parameter in constraint-expression
Status
tentatively ready
Section
7.5.7.5 [expr.prim.req.nested]
Submitter
Richard Smith

Created on 2019-06-10.00:00:00 last changed 3 weeks ago

Messages

Date: 2023-01-07.14:32:23

Proposed resolution (approved by CWG 2023-01-06):

Remove 7.5.7.5 [expr.prim.req.nested] paragraph 2, including its example:

A local parameter shall only appear as an unevaluated operand (7.2.3 [expr.context]) within the constraint-expression. [Example 2:

  template<typename T> concept C = requires (T a) {
    requires sizeof(a) == 4; // OK
    requires a == 0; // error: evaluation of a constraint variable
  };
Date: 2022-09-25.18:08:42

According to 7.5.7.5 [expr.prim.req.nested] paragraph 2,

A local parameter shall only appear as an unevaluated operand (7.2.3 [expr.context]) within the constraint-expression. [Example 2:

  template<typename T> concept C = requires (T a) {
    requires sizeof(a) == 4; // OK
    requires a == 0; // error: evaluation of a constraint variable
  };

end example]

However, a can't be used in a constant expression in any event, so the restriction is meaningless, except for ruling out an expression like true ? true : a, but there seems no reason to have a special rule for such a case.

History
Date User Action Args
2023-01-07 14:32:23adminsetstatus: open -> tentatively ready
2022-02-18 07:47:23adminsetmessages: + msg6726
2019-06-10 00:00:00admincreate