[libcxx-commits] [libcxx] [libc++] proper guarding for locale usage in filesystem on Windows (PR #165470)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 4 02:33:18 PST 2025


================
@@ -24,28 +25,30 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
+#  if !defined(_LIBCPP_WIN32API) || _LIBCPP_HAS_LOCALIZATION
 template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
   static_assert(
-#  if _LIBCPP_HAS_CHAR8_T
+#    if _LIBCPP_HAS_CHAR8_T
       is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
-#  endif
+#    endif
           is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
       "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
       " or 'char8_t'");
-#  if defined(_LIBCPP_WIN32API)
+#    if defined(_LIBCPP_WIN32API)
   string __tmp(__f, __l);
   using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
   std::wstring __w;
   __w.reserve(__tmp.size());
   _CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
   return path(__w);
-#  else
+#    else
   return path(__f, __l);
-#  endif /* !_LIBCPP_WIN32API */
+#    endif /* !_LIBCPP_WIN32API */
----------------
philnik777 wrote:

Let's update the comments here and below as well, since we're touching them anyways.

https://github.com/llvm/llvm-project/pull/165470


More information about the libcxx-commits mailing list