summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-05 14:29:36 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-12-05 14:29:44 (GMT)
commit3e8f0211378664665abc5e09503296eb4825b50a (patch)
treef5f836c5d3f7fb94a3100e729080737f50fa3b30 /Source
parentd301276bf5fb1a6336b3a42ab3005332692bf2d0 (diff)
parent40af103402b1a6f2d19f7531dfacb23010225392 (diff)
downloadCMake-3e8f0211378664665abc5e09503296eb4825b50a.zip
CMake-3e8f0211378664665abc5e09503296eb4825b50a.tar.gz
CMake-3e8f0211378664665abc5e09503296eb4825b50a.tar.bz2
Merge topic 'RH-gcc-toolset-10-bug-check' into release-3.28
40af103402 cmCMakePath: do not use std::filesystem::path with RH gcc-toolset-10 Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9026
Diffstat (limited to 'Source')
-rw-r--r--Source/Checks/cm_cxx_filesystem.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx
index 732f28f..c8df589 100644
--- a/Source/Checks/cm_cxx_filesystem.cxx
+++ b/Source/Checks/cm_cxx_filesystem.cxx
@@ -1,5 +1,8 @@
#include <filesystem>
+#if defined(__GLIBCXX__)
+# include <string_view>
+#endif
int main()
{
@@ -34,5 +37,30 @@ int main()
p5.remove_filename();
#endif
+#if defined(__GLIBCXX__)
+ // RH gcc-toolset-10 has a strange bug: it selects, in some circumstances,
+ // the wrong constructor which generate error in template instantiation.
+ class my_string_view : std::string_view
+ {
+ public:
+ my_string_view(const char* p)
+ : std::string_view(p)
+ {
+ }
+ };
+ class my_path
+ {
+ public:
+ my_path(std::filesystem::path path) {}
+
+ my_path(my_string_view path) {}
+ };
+
+ my_path p{ my_string_view{ "abc" } };
+ // here is the bug: the constructor taking std::filesystem::path as argument
+ // is selected, so the compiler try to build a std::filesystem::path instance
+ // from the my_string_view argument and fails to do so.
+#endif
+
return 0;
}