From: Jonathan Wakely Date: Mon, 9 May 2016 10:09:37 +0000 (+0100) Subject: libstdc++/71004 fix recursive_directory_iterator default constructor X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4cce0cea0ef842e4969469c3856529acd98db1f;p=gcc.git libstdc++/71004 fix recursive_directory_iterator default constructor 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ab6df14d103..cda02f4d2e3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2016-05-09 Jonathan Wakely + + 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 * testsuite/lib/libstdc++.exp (libstdc++_init): Enable on *-*-solaris*. diff --git a/libstdc++-v3/include/experimental/bits/fs_dir.h b/libstdc++-v3/include/experimental/bits/fs_dir.h index 4e28c8e9240..f128ccecf7a 100644 --- a/libstdc++-v3/include/experimental/bits/fs_dir.h +++ b/libstdc++-v3/include/experimental/bits/fs_dir.h @@ -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 diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc index 5d2e45b2e64..a2636029f42 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc @@ -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() {