This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
A trivially copyable class is not permitted to have a user-declared copy assignment operator (11.2 [class.prop] paragraph 1). However, a template assignment operator is not considered a copy assignment operator, even though its specializations can be selected by overload resolution for performing copy operations (11.4.6 [class.copy.assign] paragraph 12). Consequently, X in the following code is trivially copyable notwithstanding the fact that copy assignment (for a non-const operand) is a member function call rather than a bitwise copy:
struct X {
template<typename T> const X& operator=(T&);
};
void f() {
X x1, x2;
x1 = x2; // calls X::operator=<X>(X&)
}
Is this intentional?
Additional notes (October, 2025)
Updated the issue description to refer to the current term "trivially copyable" instead of "POD".
Closing as NAD at the suggestion of the issue submitter; it is intentional that special member function templates are not considered for the definition of "trivially copyable", even though they might be selected by overload resolution during copy or move operations.