[diff.cpp23.temp] (original) (raw)

Annex C (informative) Compatibility [diff]

C.1 C++ and ISO C++ 2023 [diff.cpp23]

C.1.5 [temp]: templates [diff.cpp23.temp]

Affected subclause: [temp.constr]

Change: Some atomic constraints become fold expanded constraints.

Rationale: Permit the subsumption of fold expressions.

Effect on original feature: Valid C++ 2023 code may become ill-formed.

[Example 1: template <typename ...V> struct A;struct S { static constexpr int compare(const S&) { return 1; } };template <typename ...T, typename ...U> void f(A<T ...> *, A<U ...> *) requires (T::compare(U{}) && ...); void g(A<S, S> *ap) { f(ap, ap);} — _end example_]

Affected subclause: [temp.deduct.call]

Change: Template argument deduction from overload sets succeeds in more cases.

Rationale: Allow consideration of constraints to disambiguate overload sets used as parameters in function calls.

Effect on original feature: Valid C++ 2023 code may become ill-formed.

[Example 2: template <typename T> void f(T &&, void (*)(T &&));void g(int &); inline namespace A { void g(short &&); } inline namespace B { void g(short &&); } void q() { int x; f(x, g); }

There is no change to the applicable deduction rules for the individual g candidates: Type deduction from #1 does not succeed; type deductions from #2 and #3 both succeed.

— _end example_]