cplusplus / cplusplus/draft

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

Open
#5,460 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing [expr.prim.req.nested] and [expr.prim.req.compound] with the definitions in [temp.constr.constr]. Determine how constraint-expressions in nested, compound, and other requirements relate to the three formal constraint kinds and normalization. Done means the draft states consistently what is constrained and how satisfaction is defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.