> Yes, I recognize the issue. This can be resolved by stating that implementations may refuse to relocate function parameters, and providing a mechanism (e.g. an attribute) for the author to switch ABI to callee-destroy.
It's more complicated than that. If relocation also destructs objects, then you allow for a new category of unmovable objects to support relocation. For example, std::lock_guard could be relocatable with no change.
Then how do you deal with this?
void foo(lock_guard<mutex> lg);
void fwd_to_foo(lock_guard<mutex> lg) { foo(reloc lg); }
void bar(mutex& m)
{
std::lock_guard lg{m};
fwd_to_foo(reloc lg);
}
This code will work fine if reloc avoids the destructor call. But it will not if "implementations refuse to relocate", as lock_guard is not movable.