Implement correct std::variant triviality rules from P0602R4

Programming / Compilers / GCC - redi [138bc75d-0d04-0410-961f-82ee72b054a4] - 23 April 2019 12:48 EDT

The std::variant move assignment operator should not be trivial if the
variant is not trivially move constructible.

- include/std/variant (__detail::__variant::_Traits): Make _S_trivial_copy_assign depend on _S_trivial_copy_ctor and make _S_trivial_move_assign depend on _S_trivial_move_ctor, as per P0602R4. (__detail::__variant::_Copy_assign_alias): Only depend on _S_trivial_copy_assign, which subsumes _S_trivial_copy_ctor now.
- testsuite/20_util/variant/compile.cc: Correct checks for trivial move assignment operators.

a4265b66a3f Implement correct std::variant triviality rules from P0602R4
libstdc++-v3/ChangeLog | 9 +++++++++
libstdc++-v3/include/std/variant | 13 +++++++------
libstdc++-v3/testsuite/20_util/variant/compile.cc | 14 +++++++-------
3 files changed, 23 insertions(+), 13 deletions(-)

Upstream: gcc.gnu.org


  • Share