]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / filesystem / filesystem_error / copy.cc
index 529e1e406e224f2235c84125d3839f424bd9e4a5..548856a1f619d6ed0a885496b09359bd0afecb27 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2019 Free Software Foundation, Inc.
+// Copyright (C) 2018-2020 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=gnu++17 -lstdc++fs" }
+// { dg-options "-std=gnu++17" }
 // { dg-do run { target c++17 } }
 // { dg-require-filesystem-ts "" }
 
 
 using std::filesystem::filesystem_error;
 
+// The COW std::string does not have noexcept copies, because copying a
+// "leaked" string can throw (and for fully-dynamic strings, copying the
+// empty rep can also throw).
+// That's OK, because we know that the std::string in the std::runtime_error
+// or std::logic_error base class won't be leaked (and usually won't be empty).
+// The is_nothrow_xxx type traits don't know that though, so we can only
+// check them for the cxx11 ABI, which uses __cow_string, which has noexcept
+// copies.
+#if _GLIBCXX_USE_CXX11_ABI
 // PR libstdc++/83306
 static_assert(std::is_nothrow_copy_constructible_v<filesystem_error>);
 static_assert(std::is_nothrow_copy_assignable_v<filesystem_error>);
+#endif
 
 void
 test01()