Created on 2026-09-30.00:00:00 last changed 5 days ago
CWG 2026-10-06
See also GCC bugzilla #127627.
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]
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.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-10-16 19:06:14 | admin | set | status: open -> tentatively ready |
| 2026-10-06 18:57:40 | admin | set | messages: + msg8700 |
| 2026-09-30 19:11:00 | admin | set | messages: + msg8689 |
| 2026-09-30 00:00:00 | admin | create | |