/// Compare paths
friend bool operator==(const path& __lhs, const path& __rhs) noexcept
- { return __lhs.compare(__rhs) == 0; }
+ { return path::_S_compare(__lhs, __rhs) == 0; }
#if __cpp_lib_three_way_comparison
/// Compare paths
friend strong_ordering
operator<=>(const path& __lhs, const path& __rhs) noexcept
- { return __lhs.compare(__rhs) <=> 0; }
+ { return path::_S_compare(__lhs, __rhs) <=> 0; }
#else
/// Compare paths
friend bool operator!=(const path& __lhs, const path& __rhs) noexcept
static basic_string<_CharT, _Traits, _Allocator>
_S_str_convert(basic_string_view<value_type>, const _Allocator&);
+ // Returns lhs.compare(rhs), but defined after path::iterator is complete.
+ __attribute__((__always_inline__))
+ static int
+ _S_compare(const path& __lhs, const path& __rhs) noexcept;
+
void _M_split_cmpts();
_Type _M_type() const noexcept { return _M_cmpts.type(); }
return _M_at_end == __rhs._M_at_end;
}
+ // Define this now that path and path::iterator are complete.
+ // It needs to consider the string_view(Range&&) constructor during
+ // overload resolution, which depends on whether range<path> is satisfied,
+ // which depends on whether path::iterator is complete.
+ inline int
+ path::_S_compare(const path& __lhs, const path& __rhs) noexcept
+ { return __lhs.compare(__rhs); }
+
/// @} group filesystem
_GLIBCXX_END_NAMESPACE_CXX11
} // namespace filesystem
size_t hash_value(const path& __p) noexcept;
/// Compare paths
- inline bool operator<(const path& __lhs, const path& __rhs) noexcept
- { return __lhs.compare(__rhs) < 0; }
+ inline bool operator<(const path& __lhs, const path& __rhs) noexcept;
/// Compare paths
inline bool operator<=(const path& __lhs, const path& __rhs) noexcept
{ return !(__lhs < __rhs); }
/// Compare paths
- inline bool operator==(const path& __lhs, const path& __rhs) noexcept
- { return __lhs.compare(__rhs) == 0; }
+ inline bool operator==(const path& __lhs, const path& __rhs) noexcept;
/// Compare paths
inline bool operator!=(const path& __lhs, const path& __rhs) noexcept
return _M_at_end == __rhs._M_at_end;
}
+ // Define these now that path and path::iterator are complete.
+ // They needs to consider the string_view(Range&&) constructor during
+ // overload resolution, which depends on whether range<path> is satisfied,
+ // which depends on whether path::iterator is complete.
+ inline bool operator<(const path& __lhs, const path& __rhs) noexcept
+ { return __lhs.compare(__rhs) < 0; }
+
+ inline bool operator==(const path& __lhs, const path& __rhs) noexcept
+ { return __lhs.compare(__rhs) == 0; }
+
/// @} group filesystem-ts
_GLIBCXX_END_NAMESPACE_CXX11
} // namespace v1
--- /dev/null
+// { dg-options "-std=gnu++23" }
+// { dg-do compile { target c++23 } }
+
+#include <filesystem>
+
+void
+test01()
+{
+ using std::filesystem::path;
+ path p;
+ path::string_type s(p);
+}
--- /dev/null
+// { dg-options "-std=gnu++23" }
+// { dg-do compile { target c++23 } }
+
+#include <experimental/filesystem>
+
+void
+test01()
+{
+ using std::experimental::filesystem::path;
+ path p;
+ path::string_type s(p);
+}