The destructor is called whenever an object's lifetime ends, which includes
end of scope, for objects with automatic storage duration and for
temporaries whose life was extended by binding to a reference
So bar
which is the owner of copied object will call dtor
on the copied object.
Cppreference