This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/86874] [8/9 Regression] std::swap on std::variant fails to compile
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 07 Aug 2018 21:39:22 +0000
- Subject: [Bug libstdc++/86874] [8/9 Regression] std::swap on std::variant fails to compile
- Auto-submitted: auto-generated
- References: <bug-86874-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86874
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Aug 7 21:38:50 2018
New Revision: 263368
URL: https://gcc.gnu.org/viewcvs?rev=263368&root=gcc&view=rev
Log:
PR libstdc++/86874 fix std::variant::swap regression
Backport from mainline
2018-08-07 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/86874
* include/std/variant (_Copy_ctor_base::_M_destructive_move): Define
here instead of in _Move_assign_base.
(_Copy_ctor_base<true, _Types...>::_M_destructive_move): Define.
(_Copy_assign_base::operator=): Use _M_destructive_move when changing
the contained value to another alternative.
(_Move_assign_base::operator=): Likewise.
(_Move_assign_base::_M_destructive_move): Remove.
* testsuite/20_util/variant/86874.cc: New test.
Added:
branches/gcc-8-branch/libstdc++-v3/testsuite/20_util/variant/86874.cc
Modified:
branches/gcc-8-branch/libstdc++-v3/ChangeLog
branches/gcc-8-branch/libstdc++-v3/include/std/variant