Created on 2005-03-19.00:00:00 last changed 10 hours ago
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.
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?
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-10-26 11:47:31 | admin | set | messages: + msg8178 |
| 2025-10-26 11:47:31 | admin | set | status: open -> nad |
| 2005-03-19 00:00:00 | admin | create | |