aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-01-04 15:42:33 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-01-04 15:42:33 +0000
commit66f31224361a429dca68058cbfe928bc8a6601e1 (patch)
tree618a553d10d263caa6b2918cb842692f262aafb3 /libstdc++-v3
parent73d968d94561fd521bc6a9af993ed1d1ebba8459 (diff)
downloadgcc-66f31224361a429dca68058cbfe928bc8a6601e1.zip
gcc-66f31224361a429dca68058cbfe928bc8a6601e1.tar.gz
gcc-66f31224361a429dca68058cbfe928bc8a6601e1.tar.bz2
Fix test failure with old Copy-On-Write std::string
* testsuite/27_io/filesystem/filesystem_error/copy.cc: Fix static assertion failures with old std::string ABI. From-SVN: r267577
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc10
2 files changed, 13 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 499812c..00550d8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2019-01-04 Jonathan Wakely <jwakely@redhat.com>
+ * testsuite/27_io/filesystem/filesystem_error/copy.cc: Fix static
+ assertion failures with old std::string ABI.
+
* include/bits/fs_path.h (path::_List::erase): Replace both overloads
with ...
(path::pop_back(), path::_M_erase_from(const_iterator)): New member
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc b/libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc
index 529e1e4..71eac38 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc
@@ -24,9 +24,19 @@
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()