Created on 2022-06-20.00:00:00 last changed 17 months ago
Proposed resolution (approved by CWG 2022-09-09):
Append to 6.4.1 [basic.scope.scope] paragraph 3 as follows:
Change in 6.4.1 [basic.scope.scope] paragraph 4 as follows:
Change in 13.7.7.2 [temp.over.link] paragraph 7 as follows:
If the validity or meaning of the program depends on whether two constructs are equivalent, and they are functionally equivalent but not equivalent, the program is ill-formed, no diagnostic required. Furthermore, if two function templates that do not correspondthe program is ill-formed, no diagnostic required.
- have the same name,
- have corresponding signatures (6.4.1 [basic.scope.scope]),
- would declare the same entity (6.6 [basic.link]) considering them to correspond, and
- accept and are satisfied by the same set of template argument lists,
Suggested resolution (August, 2022) [SUPERSEDED]:
Append to 6.4.1 [basic.scope.scope] paragraph 3 as follows:
Change in 6.4.1 [basic.scope.scope] paragraph 4 as follows:
Change in 13.7.7.2 [temp.over.link] paragraph 7 as follows:
If the validity or meaning of the program depends on whether two constructs are equivalent, and they are functionally equivalent but not equivalent, the program is ill-formed, no diagnostic required. Furthermore, if two function templates with corresponding signatures do not correspond, but accept and are satisfied by the same set of template argument lists, the program is ill-formed, no diagnostic required.
Suggested resolution [SUPERSEDED]:
Change in 13.7.7.2 [temp.over.link] paragraph 7 as follows:
If the validity or meaning of the program depends on whether two constructs are equivalent, and they are functionally equivalent but not equivalent, the program is ill-formed, no diagnostic required. Furthermore, if two function templates do not correspond, but accept and are satisfied by the same set of template argument lists, the program is ill-formed, no diagnostic required.
[Accepted as a DR at the November, 2022 meeting.]
In C++20, 13.7.7.2 [temp.over.link] paragraph 7 defined equivalence for function templates in terms of equivalence of several of its components; functional equivalence for them was similar in that it was defined recursively for their "return types and parameter lists", but differed with regard to constraints in that it required that they "accept and are satisfied by the same set of template argument lists". P1787R6 simplified the treatment by relying entirely on the "depends on whether two constructs are equivalent, and they are functionally equivalent but not equivalent" rule to make the correspondence check between the function templates ill-formed, no diagnostic required.
This created a situation where moving a constraint between a template-head and a requires-clause makes a function template truly different (because there is no reasonable way to read 6.4.1 [basic.scope.scope] bullet 4.3.2's "equivalent [...], template-heads, and trailing requires-clauses (if any)" as requiring a joint check for functional equivalence), even if overload resolution would never be able to distinguish them.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-07-16 13:00:43 | admin | set | status: open -> c++23 |
2023-07-16 13:00:43 | admin | set | status: drwp -> open |
2023-02-18 18:43:04 | admin | set | status: dr -> drwp |
2022-11-25 05:14:04 | admin | set | status: ready -> dr |
2022-09-09 20:14:08 | admin | set | status: drafting -> ready |
2022-08-27 06:13:26 | admin | set | messages: + msg6912 |
2022-08-26 21:45:07 | admin | set | messages: + msg6908 |
2022-08-19 07:54:33 | admin | set | status: open -> drafting |
2022-06-23 22:39:13 | admin | set | messages: + msg6865 |
2022-06-20 00:00:00 | admin | create |