Re:C++ 17 is Done
by gpderetta on Saturday March 25, 2017 @04:50PM
(#13957502)
Unfortunately the abi requires non-trivially copyable/destructible types to be passed by (hidden) reference.
It should be possible to implement std::variant in such a way that it is trivially constructible and destructible as long as all elements are, but apparently stdlibc++ doesn't. This is GCC choice and other compilers apparently do differently. Unless GCC changes it before finalising their c++17 implementation, the choice will be unfortunately set in stone for them as they guarantee abi stability of the library.
P0602R0 is a proposal to require trivial copy/move (but strangely not destruct), don't know whether it has been accepted though.
It should be possible to implement std::variant in such a way that it is trivially constructible and destructible as long as all elements are, but apparently stdlibc++ doesn't. This is GCC choice and other compilers apparently do differently. Unless GCC changes it before finalising their c++17 implementation, the choice will be unfortunately set in stone for them as they guarantee abi stability of the library.
P0602R0 is a proposal to require trivial copy/move (but strangely not destruct), don't know whether it has been accepted though.