summaryrefslogtreecommitdiffstats
path: root/Utilities/std
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-21 14:05:34 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-10-21 14:06:22 (GMT)
commit7c71f9b1e8319f93418bb91dc9fbf8fcdaca8add (patch)
treec622be9e80894c733d838be2cb37d035233630d7 /Utilities/std
parent714440fdf2e99cd832570b9cee0a5d57fe225aee (diff)
parentee9805ccd17670e945e41e62f160bfdd9ad8a386 (diff)
downloadCMake-7c71f9b1e8319f93418bb91dc9fbf8fcdaca8add.zip
CMake-7c71f9b1e8319f93418bb91dc9fbf8fcdaca8add.tar.gz
CMake-7c71f9b1e8319f93418bb91dc9fbf8fcdaca8add.tar.bz2
Merge topic 'filesystem-path-c++03-abi'
ee9805ccd1 cm/filesystem: Fix crash with pre-C++11 std::string GNU ABI in C++17 Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7813
Diffstat (limited to 'Utilities/std')
-rw-r--r--Utilities/std/cm/filesystem16
1 files changed, 6 insertions, 10 deletions
diff --git a/Utilities/std/cm/filesystem b/Utilities/std/cm/filesystem
index ce52fbf..b1cb366 100644
--- a/Utilities/std/cm/filesystem
+++ b/Utilities/std/cm/filesystem
@@ -809,13 +809,11 @@ public:
path& remove_filename()
{
-# if defined(__CYGWIN__)
- // FIXME: Avoid crash due to CYGWIN/MSYS bug(?). See CMake Issue 22090.
- static_cast<void>(this->path_.data());
-# endif
auto fname = this->get_filename();
if (!fname.empty()) {
- this->path_.erase(fname.data() - this->path_.data());
+ this->path_.erase(fname.data() -
+ // Avoid C++17 non-const .data() that may reallocate.
+ static_cast<path_type const&>(this->path_).data());
}
return *this;
}
@@ -829,13 +827,11 @@ public:
path& replace_extension(const path& replacement = path())
{
-# if defined(__CYGWIN__)
- // FIXME: Avoid crash due to CYGWIN/MSYS bug(?). See CMake Issue 22090.
- static_cast<void>(this->path_.data());
-# endif
auto ext = this->get_filename_fragment(filename_fragment::extension);
if (!ext.empty()) {
- this->path_.erase(ext.data() - this->path_.data());
+ this->path_.erase(ext.data() -
+ // Avoid C++17 non-const .data() that may reallocate.
+ static_cast<path_type const&>(this->path_).data());
}
if (!replacement.path_.empty()) {
if (replacement.path_[0] != '.') {