https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112942
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Summary|swap(variant&, variant&) is |[LWG2766] swap(variant&, |incorrectly marked as |variant&) is incorrectly |deleted |marked as deleted Last reconfirmed| |2023-12-10 Status|UNCONFIRMED |SUSPENDED --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > https://wg21.cmeerw.net/lwg/issue2749 LWG 2749 added the current constraint to [variant.specalg]. The libstdc++ behaviour is because we implement the proposed resolution of LWG 2766: https://cplusplus.github.io/LWG/issue2766 That issue points out that swapping variant<A> when is_swappable_v<A> is false makes no sense. The author of A explicitly disabled swapping of A. Falling back to the generic std::swap that uses moves seems wrong. If variant's own swap overload is disabled, then swapping should be disabled. But LWG 2766 seems to have languished for years. I'll poke LWG about it.