[Bug libstdc++/122313] std::vector<T>::insert(const_iterator, InputIt, InputIt) should allow *InputIt with convertible type

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Oct 18 09:56:20 GMT 2025


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
One more case, with a scalar value type and inserting a type that is
convertible to that scalar, but which acts differently for implicit and
explicit conversions:

void test6()
{
  struct S
  {
    operator long() { throw; }
    explicit operator int() { return 0; }
  };

  S base_v[1];
  std::vector<int> v(1);
  v.reserve(2);
  v.insert(v.begin(), base_v, base_v+1);
}


More information about the Gcc-bugs mailing list