https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116731
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-09-16 Keywords| |diagnostic Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is the condition, so it is indeed using trivially copyable: /* Since small trivially copyable types are cheap to copy, we suppress the warning for them. 64B is a common size of a cache line. */ if (TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST || (tree_to_uhwi (TYPE_SIZE_UNIT (type)) <= 64 && trivially_copyable_p (type))) return; I agree that the warning seems unhelpful in this case. The fact that std::pair's copy assignment operator is not trivial is irrelevant here, we're not doing any assignment.