libstdc++: Add default-initializers to views (LWG 3364)
authorJonathan Wakely <jwakely@redhat.com>
Wed, 19 Feb 2020 22:00:14 +0000 (22:00 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Feb 2020 22:10:41 +0000 (22:10 +0000)
* include/std/ranges (take_while_view, drop_view, drop_while_view)
(elements_view:_Iterator): Initialize data members (LWG 3364).

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/ranges

index 622c2948eab8f43470c34def48b9f376e13e127c..ef91b80ef45c5b0f7ca9eeb92c89fb6e832c6802 100644 (file)
@@ -1,5 +1,8 @@
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/std/ranges (take_while_view, drop_view, drop_while_view)
+       (elements_view:_Iterator): Initialize data members (LWG 3364).
+
        * libsupc++/compare (three_way_comparable): Remove always-false check
        that should have been removed with weak_equality (P1959R0).
        (three_way_comparable_with): Likewise. Reorder requirements (LWG 3360).
index b348ba2cfcb2c70fc5e08c74c3ad3ea1af12a4e4..7a66491f2e4a9fbf3ea503cd203ebde8c5ee5a9b 100644 (file)
@@ -2008,7 +2008,7 @@ namespace views
          { return __y._M_end == __x || !std::__invoke(*__y._M_pred, *__x); }
        };
 
-      _Vp _M_base;
+      _Vp _M_base = _Vp();
       __detail::__box<_Pred> _M_pred;
 
     public:
@@ -2068,8 +2068,8 @@ namespace views
     class drop_view : public view_interface<drop_view<_Vp>>
     {
     private:
-      _Vp _M_base;
-      range_difference_t<_Vp> _M_count;
+      _Vp _M_base = _Vp();
+      range_difference_t<_Vp> _M_count = 0;
 
     public:
       drop_view() = default;
@@ -2147,7 +2147,7 @@ namespace views
     class drop_while_view : public view_interface<drop_while_view<_Vp, _Pred>>
     {
     private:
-      _Vp _M_base;
+      _Vp _M_base = _Vp();
       __detail::__box<_Pred> _M_pred;
 
     public:
@@ -3179,7 +3179,7 @@ namespace views
        {
          using _Base = conditional_t<_Const, const _Vp, _Vp>;
 
-         iterator_t<_Base> _M_current;
+         iterator_t<_Base> _M_current = iterator_t<_Base>();
 
          friend _Iterator<!_Const>;