Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expr.prim.req] What is the kind of constraints introduced by requires expressions #5460

Open
xmh0511 opened this issue May 10, 2022 · 1 comment · May be fixed by #6262
Open

[expr.prim.req] What is the kind of constraints introduced by requires expressions #5460

xmh0511 opened this issue May 10, 2022 · 1 comment · May be fixed by #6262

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 10, 2022

The category of constraints introduced in a requires expression is not clear. Such as [expr.prim.req.nested]

A nested-requirement can be used to specify additional constraints in terms of local parameters.

we just define three kinds of constraints in [temp.constr.constr]

There are three different kinds of constraints:

  • conjunctions,
  • disjunctions, and
  • atomic constraints.

Consider this example associated with nested-requirement

template<typename T> concept C = requires (T a) {
     requires sizeof(a) >0 || true;      
};

sizeof(a) >0 || true is a constraint-expression but not a constraint. In this case, we also cannot know what kind of constraint the expression is. Presumably, the normalization should apply to these expressions to bring them to be the formal constraints.

A similar issue also exists in other kinds of requirements. [expr.prim.req.compound] p1

The immediately-declared constraint ([temp.param]) of the type-constraint for decltype((E)) shall be satisfied.

Again, what's the kind of that constraint? if the type-constraint's constraint-expression has the form E1 || E2, E1 && E2 or ( E ). Moreover, "is satisfied" is only defined for constraints, and we only define how the constraint is satisfied in [temp.constr.constr] for three kinds of formal constraints. We might make the normalization apply to all expressions when we want to say the constraint shall be satisfied.

@frederick-vs-ja
Copy link
Contributor

It seems that a constraint-expression is not itself a constraint, but its normal form ([temp.constr.normal] p1) is.

Should we simply say the following?

[...] The normal form of the constraint-expression shall be satisfied ([temp.constr.decl]) by the substituted template arguments, if any. [...]

I wonder whether this can be resolved editorially...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants