The Itanium ABI specifies that...
A type is non-trivial for the purposes of a call if:
- it has a non-trivial copy constructor, move constructor, or destructor, or
- all of its copy and move constructors are deleted.
Currently, the trivial_abi attribute only "undoes" the first bullet but not the second. This patch would allow types with a deleted move and copy constructors to also be trivial (so long as the other conditions are met).
I stumbled upon this limitation in D66262, where we ran into a problem:
- The "trivial_abi" attribute requires a move constructor or a copy constructor.
- The standard requires that unique_ptr's "move constructor" doesn't participate in overload resolution unless a requirement is met. This requires a templated "move constructor" so that the function may be disabled.
- A move constructor is not permitted to be templated.
There are ways to solve this in the library without changing the trivial_abi attribute itself, but it revealed a set of use cases that should probably be supported regardless.
Thanks to @ahatanak for helping me understand this issue better. (And implementing the trivial_abi attribute in the first place.)
Refs D57626, r352822, r350920.