mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 05:26:58 +08:00
cmCMakePath: do not use std::filesystem::path with RH gcc-toolset-10
Fixes: #25458, #25453
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#if defined(__GLIBCXX__)
|
||||||
|
# include <string_view>
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -34,5 +37,30 @@ int main()
|
|||||||
p5.remove_filename();
|
p5.remove_filename();
|
||||||
#endif
|
#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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user