tmp/tmp__qqexuu/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### [[temp]]: templates <a id="diff.cpp23.temp">[[diff.cpp23.temp]]</a>
|
| 2 |
+
|
| 3 |
+
**Change:** Some atomic constraints become fold expanded constraints.
|
| 4 |
+
**Rationale:** Permit the subsumption of fold expressions. **Effect on
|
| 5 |
+
original feature:** Valid C++23 code may become ill-formed.
|
| 6 |
+
|
| 7 |
+
[*Example 1*:
|
| 8 |
+
|
| 9 |
+
``` cpp
|
| 10 |
+
template <typename ...V> struct A;
|
| 11 |
+
struct S {
|
| 12 |
+
static constexpr int compare(const S&) { return 1; }
|
| 13 |
+
};
|
| 14 |
+
|
| 15 |
+
template <typename ...T, typename ...U>
|
| 16 |
+
void f(A<T ...> *, A<U ...> *)
|
| 17 |
+
requires (T::compare(U{}) && ...); // was well-formed (atomic constraint of type bool),
|
| 18 |
+
// now ill-formed (results in an atomic constraint of type int)
|
| 19 |
+
void g(A<S, S> *ap) {
|
| 20 |
+
f(ap, ap);
|
| 21 |
+
}
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
— *end example*]
|
| 25 |
+
|
| 26 |
+
**Change:** Template argument deduction from overload sets succeeds in
|
| 27 |
+
more cases. **Rationale:** Allow consideration of constraints to
|
| 28 |
+
disambiguate overload sets used as parameters in function calls.
|
| 29 |
+
**Effect on original feature:** Valid C++23 code may become ill-formed.
|
| 30 |
+
|
| 31 |
+
[*Example 2*:
|
| 32 |
+
|
| 33 |
+
``` cpp
|
| 34 |
+
template <typename T>
|
| 35 |
+
void f(T &&, void (*)(T &&));
|
| 36 |
+
|
| 37 |
+
void g(int &); // #1
|
| 38 |
+
inline namespace A {
|
| 39 |
+
void g(short &&); // #2
|
| 40 |
+
}
|
| 41 |
+
inline namespace B {
|
| 42 |
+
void g(short &&); // #3
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
void q() {
|
| 46 |
+
int x;
|
| 47 |
+
f(x, g); // ill-formed; previously well-formed, deducing T = int&
|
| 48 |
+
}
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
There is no change to the applicable deduction rules for the individual
|
| 52 |
+
`g` candidates: Type deduction from \#1 does not succeed; type
|
| 53 |
+
deductions from \#2 and \#3 both succeed.
|
| 54 |
+
|
| 55 |
+
— *end example*]
|
| 56 |
+
|