[PATCH] Remove incorrect assertion from filesystem::absolute
Jonathan Wakely
jwakely@redhat.com
Thu May 16 22:52:00 GMT 2019
The assertion is wrong, it should be *s.end() == 0, but that's not
allowed. Just remove it, but keep the comment.
* src/c++17/fs_ops.cc (absolute(const path&, error_code&))
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Remove bogus assertion.
Tested x86_64-w64-mingw32, committed to trunk.
-------------- next part --------------
commit 6f4fd5fec3488ecc977a7d29f8538a934e6e35ac
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu May 16 23:31:30 2019 +0100
Remove incorrect assertion from filesystem::absolute
The assertion is wrong, it should be *s.end() == 0, but that's not
allowed. Just remove it, but keep the comment.
* src/c++17/fs_ops.cc (absolute(const path&, error_code&))
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Remove bogus assertion.
diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc
index 2d13b172d69..274ee7f0834 100644
--- a/libstdc++-v3/src/c++17/fs_ops.cc
+++ b/libstdc++-v3/src/c++17/fs_ops.cc
@@ -96,6 +96,7 @@ fs::absolute(const path& p, error_code& ec)
}
#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ // s must remain null-terminated
wstring_view s = p.native();
if (p.has_root_directory()) // implies !p.has_root_name()
@@ -108,9 +109,6 @@ fs::absolute(const path& p, error_code& ec)
s.remove_prefix(std::min(s.length(), pos) - 1);
}
- // s must be null-terminated
- __glibcxx_assert(!s.empty() && s.back() == 0);
-
uint32_t len = 1024;
wstring buf;
do
More information about the Libstdc++
mailing list