There is a demonstrative code for std::is_trivially_copyable https://en.cppreference.com/w/cpp/types/is_trivially_copyable
void test()
{
struct A {
int m;
A(const A& o):m(o.m){}
};
struct D {
int m;
D(D const&) = default; // -> trivially copyable
D(int x) : m(x + 1) {}
};
std::cout << std::is_trivially_copyable<A>::value << '\n';
std::cout << std::is_trivially_copyable<D>::value << '\n';
}
A is not trivially copyable, D does. I implement A's copy constructor with the default behavior. What does cause the difference?