]> 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 f085f9d6794a99063c43bb3f57a27c8072c3dd1e..944f99cbe254f2af0fffbdaaf8d62449f3696640 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Free Software Foundation, Inc.
+// Copyright (C) 2018-2024 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,6 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=gnu++17 -lstdc++fs" }
 // { 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()