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

[temp.names] p9 The process of the parameter mapping is omitted #5459

Open
xmh0511 opened this issue May 10, 2022 · 0 comments
Open

[temp.names] p9 The process of the parameter mapping is omitted #5459

xmh0511 opened this issue May 10, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 10, 2022

[temp.names] p9 says

A concept-id evaluates to true if the concept's normalized constraint-expression ([temp.constr.decl]) is satisfied ([temp.constr.constr]) by the specified template arguments and false otherwise.

Consider this example:

template<std::size_t N>
concept GreaterThanZero = N > 0;

template<std::size_t I>
requires (!GreaterThanZero< I - 1>) void fun(){}

fun<1>();

According to [temp.constr.normal] p1

The normal form of an expression E is a constraint that is defined as follows:

  • The normal form of an expression ( E ) is the normal form of E.
  • [...]
  • [...]
  • The normal form of a concept-id C<A1, A2,..., An> is the normal form of the constraint-expression of C, after substituting A1, A2,..., An for C's respective template parameters in the parameter mappings in each atomic constraint. If any such substitution results in an invalid type or expression, the program is ill-formed; no diagnostic is required.
    the constraint of the declaration is defined as
  • The normal form of any other expression E is the atomic constraint whose expression is E and whose parameter mapping is the identity mapping.

For this case, only the first and the last bullet applies to (!GreaterThanZero<I - 1>) and !GreaterThanZero<I - 1>, respectively, and !GreaterThanZero<N> is regarded as an atomic constraint. When determining whether such an atomic is satisfied or not, the concept-id GreaterThanZero<N> is therefore evaluated. However, [temp.names] p9 only says the normalization of the constraint-expression of the concept, in this case, it's N > 0. We lack to specify the parameter mapping as specified in the fourth bullet, namely mapping N ↦ I -1 for the normalization of a concept-id<A1,A2,..., An>.

Should we just say

A concept-id evaluates to true if the normalization of the concept-id is satisfied and false otherwise.

This can make the parameter mapping in the atomic constraints more clear. The whole process of determination of satisfication is consistent with other subclasses.

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

No branches or pull requests

1 participant