https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102749

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
>From the error message, I think the code looks like this:

#include <vector>
#include <variant>

using T = unsigned;
using Vec = std::vector<T>;

struct Cont
{
  void insert(std::variant<Vec::iterator, void*>&&, int) { }
  void insert(std::variant<Vec::const_iterator, void*>&&, int) { }
};

int main()
{
  Vec::iterator i{};
  Cont c;
  c.insert(i, 1);
}


And GCC is correct to reject it, this code is invalid. The vector iterator can
be converted to variant<iterator> and to variant<const_iterator> and both
implicit conversion sequences are equal rank.

Clang with libc++ rejects it too, for the same reason.

Reply via email to