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

--- Comment #4 from Nuno Lopes <nuno.lopes at tecnico dot ulisboa.pt> ---
Sorry, got the wrong example.
This is what I meant:
std::vector<bool> mainf() {
  return {true, true, true};
}

goes here:
      _GLIBCXX20_CONSTEXPR
      vector(initializer_list<bool> __l,
             const allocator_type& __a = allocator_type())
      : _Base(__a)
      {
        _M_initialize_range(__l.begin(), __l.end(),
                            random_access_iterator_tag());
      }


then here:

      template<typename _ForwardIterator>
        _GLIBCXX20_CONSTEXPR
        void
        _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
                            std::forward_iterator_tag)
        {
          const size_type __n = std::distance(__first, __last);
          _M_initialize(__n);
          std::copy(__first, __last, begin());
        }

std::copy calls operator[], but _M_initialize() doesn't do a memset(0) on the
buffer.

Reply via email to