The compiler will try to optimize such functions in order to eliminate copy operations. The resulting code will behave as if the object was created at the point where the function would return it with appropriate lifetime. Reference here.
This is dependent upon the compiler, and the structure of the code itself at both the construction and use points. The optimization may also not be possible, in which case you may have calls to copy or move constructor if available.
If the compiler optimizes the function, then the destructor will be called when the object at the use point goes out of nearest block scope.
If there is no optimization, then the object will be copied to another at the use point (one call to copy/move constructor), then the object in the function will be destroyed (if copied), and finally the destructor of the copied/moved object will be called when it goes out of nearest block scope at the location where the function returned it (use point).
However, if you return a temporary from a function then you will return a reference or pointer to destructed memory because your temporary will go out of scope upon function return and be destroyed.