This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 121a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2026-10-16
Consider:
template <class T>
struct X {
X() = default;
X(const X&) = default;
private:
explicit X(const X&) requires (T::value) = default; // #1
};
struct S { static constexpr bool value = true; };
int main() {
const X<S> x;
X<S> x2 = x; // #2
}
According to 11.4.4 [special] paragraph 6, the public copy constructor is not eligible, because #1 is more constrained. This causes it to be deleted (9.6.2 [dcl.fct.def.default] paragraph 5). Yet, the public copy constructor is selected by overload resolution when used at #2.
Proposed resolution (approved by CWG 2026-10-16):
Change in 11.4.4 [special] paragraph 6 as follows:
An eligible special member function is a special member function for which:
- the function is not deleted,
- the associated constraints (13.5 [temp.constr]), if any, are satisfied, and
- there exists no special member function
where a function F1 is more explicit than a function F2 if F1 is explicit (9.2.3 [dcl.fct.spec]) and F2 is not.
- that is of the same kind,
- that is not more explicit,
- whose associated constraints, if any, are satisfied, and
- that is more constrained (13.5.5 [temp.constr.order]),
[ Example:
template <class T> struct X { X() = default; X(const X&) = default; // #1 private: explicit X(const X&) requires true = default; // #2 }; int main() { X<int> x; X<int> x2 = x; // OK, selects #1; both #1 and #2 are eligible }-- end example]
CWG 2026-10-06
See also GCC bugzilla #127627.