libstdc++/71004 fix recursive_directory_iterator default constructor
authorJonathan Wakely <jwakely@redhat.com>
Mon, 9 May 2016 10:09:37 +0000 (11:09 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 9 May 2016 10:09:37 +0000 (11:09 +0100)
PR libstdc++/71004
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Initialize scalar member variables in default constructor.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Teste default construction.

From-SVN: r236023

libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/bits/fs_dir.h
libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc

index ab6df14d103b01b6a32fa9aceeb1db9ad8b652ed..cda02f4d2e38ba10d91d8a8beeb73c84f578ef06 100644 (file)
@@ -1,3 +1,11 @@
+2016-05-09  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/71004
+       * include/experimental/bits/fs_dir.h (recursive_directory_iterator):
+       Initialize scalar member variables in default constructor.
+       * testsuite/experimental/filesystem/iterators/
+       recursive_directory_iterator.cc: Teste default construction.
+
 2016-05-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * testsuite/lib/libstdc++.exp (libstdc++_init): Enable on *-*-solaris*.
index 4e28c8e9240c7cd2d5a454dc2bfcd48466d1005c..f128ccecf7acec6c76334210eb864320e8110eba 100644 (file)
@@ -301,8 +301,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 
     struct _Dir_stack;
     std::shared_ptr<_Dir_stack> _M_dirs;
-    directory_options _M_options;
-    bool _M_pending;
+    directory_options _M_options = {};
+    bool _M_pending = false;
   };
 
   inline recursive_directory_iterator
index 5d2e45b2e64af9f70e12e98951387afebf0add10..a2636029f423c2c5ba9cf819502f00e458e7376e 100644 (file)
@@ -97,6 +97,16 @@ test01()
   remove_all(p, ec);
 }
 
+void
+test02()
+{
+  // libstdc++71004
+  const fs::recursive_directory_iterator it;
+  assert( it.options() == fs::directory_options{} );
+  assert( it.depth() == 0 );
+  assert(it.recursion_pending() == false);
+}
+
 int
 main()
 {