https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90008
Bug ID: 90008 Summary: [9 Regression] variant attempts to copy rhs in comparison operators Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- _VARIANT_RELATION_FUNCTION_TEMPLATE accidentally accepts the second visitable by copy in `__do_visit<__detail::__variant::__visit_with_index>`. The following test fails right now, but worked in GCC-8: #include <variant> struct user_defined { user_defined(); user_defined(const user_defined&) = delete; user_defined(user_defined&&) = delete; }; bool operator==(const user_defined& x, const user_defined& y) { return true; } using v_t = std::variant<user_defined, int>; auto test(const v_t& v, const v_t& v2) { return v == v2; }