Created on 2020-01-21.00:00:00 last changed 5 months ago
CWG 2023-06-17
There are arguments in favor of both options. Forwarded to EWG with paper issue 1582.
EWG 2023-11-07
Accept the proposed resolution and forward to CWG for inclusion in C++26.
Proposed resolution (approved by CWG 2023-11-07):
Change in 7.5.8.1 [expr.prim.req.general] paragraph 3 as follows:
A requires-expression may introduce local parameters using a parameter-declaration-clause(9.3.4.6 [dcl.fct]). A local parameter of a requires-expression shall not have a default argument. The type of such a parameter is determined as specified for a function parameter in 9.3.4.6 [dcl.fct]. These parameters have no linkage, storage, or lifetime; they are only used as notation for the purpose of defining requirements. The parameter-declaration-clause of a requirement-parameter-list shall not terminate with an ellipsis.
[Example 2:template<typename T> concept C = requires(T t, ...) { // error: terminates with an ellipsis t; }; template<typename T> concept C2 = requires(T p[2]) { (decltype(p))nullptr; // OK, p has type "pointer to T" };—end example]
[Accepted as a DR at the March, 2024 meeting.]
Consider:
template<typename T>
requires requires (T p[10]) { (decltype(p))nullptr; }
int v = 42;
auto r = v<int>; // well-formed?
This example is only well-formed if the type of the parameter p is adjusted to T*, but the provisions in 9.3.4.6 [dcl.fct] paragraph 5 cover function parameters only.
One option is to specify application of the same adjustments as for function parameters. Another option is to specify rules that arguably are more useful in a requires-expression.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-20 13:52:34 | admin | set | status: dr -> drwp |
2024-04-05 21:43:46 | admin | set | status: ready -> dr |
2024-03-20 14:10:31 | admin | set | status: tentatively ready -> ready |
2023-12-02 15:54:05 | admin | set | status: review -> tentatively ready |
2023-11-07 22:25:49 | admin | set | status: open -> review |
2023-06-20 06:44:53 | admin | set | messages: + msg7329 |
2022-03-31 07:31:09 | admin | set | messages: + msg6784 |
2020-01-21 00:00:00 | admin | create |