summaryrefslogtreecommitdiffstats
path: root/Source/Checks
diff options
context:
space:
mode:
authorMichael Pratt <mcpratt@pm.me>2024-08-13 10:03:15 (GMT)
committerBrad King <brad.king@kitware.com>2024-08-15 15:31:01 (GMT)
commit2216843fd5327d05152f4959e65f7eb76ee7994d (patch)
treeb0d4677e83502c3ba390142dd76013e68fad3995 /Source/Checks
parent8733dcd11588f2d9eb0bddc8af8a6db7a2e9eba8 (diff)
downloadCMake-2216843fd5327d05152f4959e65f7eb76ee7994d.zip
CMake-2216843fd5327d05152f4959e65f7eb76ee7994d.tar.gz
CMake-2216843fd5327d05152f4959e65f7eb76ee7994d.tar.bz2
cm_cxx_filesystem: Improve detection of std::filesystem support on GCC
The check added by commit 40af103402 (cmCMakePath: do not use std::filesystem::path with RH gcc-toolset-10, 2023-12-02, v3.28.0~5^2) fails unnecessarily in some cases due to not inheriting `std::string_view` publicly. Inheritance into a class is private by default, and this std class has public members that would be access restricted when used to create public objects in the current scope. On some versions of GCC, depending on standards options, this causes either template instantiation errors, or "inaccessible base" or "not declared" errors. Fix by setting the inheritance to public. This does not affect the intention of the previous fix because the check still fails when using gcc-toolset-10's standard library with clang. Issue: #25458, #25453
Diffstat (limited to 'Source/Checks')
-rw-r--r--Source/Checks/cm_cxx_filesystem.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx
index bdc7c6d..456ec46 100644
--- a/Source/Checks/cm_cxx_filesystem.cxx
+++ b/Source/Checks/cm_cxx_filesystem.cxx
@@ -47,7 +47,7 @@ int main()
#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
+ class my_string_view : public std::string_view
{
public:
my_string_view(const char* p)