This is the compiler half of C++ proposal 1144 "Object relocation in terms of move plus destroy," as seen on https://godbolt.org/g/zUUAVW and https://quuxplusone.github.io/blog/2018/07/18/announcing-trivially-relocatable/ .
There are two parts to this compiler support:
- the type trait __is_trivially_relocatable(T), which is similar in spirit to __is_trivially_destructible(T), in that it lets the programmer access information that the compiler itself already knows; and
- the warranting attribute [[clang::trivially_relocatable]], which is similar in spirit to [[clang::trivial_abi]], in that it lets the programmer communicate back to the compiler that a certain user-defined type should be assumed to have this property even though it would not naturally have the property all else being equal.
The official home of this branch thus far has been https://github.com/Quuxplusone/clang/tree/trivially-relocatable , but I figure that a Clang review would be a good way to get some more eyeballs on it, plus, if we can get it into Clang trunk then I wouldn't have to keep rebasing it every week.