Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.

Commit 202f559

Browse files
committed
Test for std::format using __cpp_lib_format
Fixes compilation on libc++ 16
1 parent f32138f commit 202f559

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

include/proxy/v4/proxy.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020

2121
#if __STDC_HOSTED__
2222
#include <atomic>
23-
#if __has_include(<format>)
23+
#include <version>
24+
#if __cpp_lib_format
2425
#include <format>
25-
#endif // __has_include(<format>)
26+
#endif // __cpp_lib_format
2627
#endif // __STDC_HOSTED__
2728

2829
#if __cpp_rtti >= 199711L
@@ -2125,7 +2126,7 @@ struct weak_conversion_dispatch : cast_dispatch_base<false, true> {
21252126
template <class F>
21262127
using weak_conversion_overload = weak_proxy<F>() const noexcept;
21272128

2128-
#if __STDC_HOSTED__ && __has_include(<format>)
2129+
#if __STDC_HOSTED__ && __cpp_lib_format
21292130
template <class CharT>
21302131
struct format_overload_traits;
21312132
template <>
@@ -2166,7 +2167,7 @@ struct format_dispatch {
21662167
return impl.format(self, fc);
21672168
}
21682169
};
2169-
#endif // __STDC_HOSTED__ && __has_include(<format>)
2170+
#endif // __STDC_HOSTED__ && __cpp_lib_format
21702171

21712172
#if __cpp_rtti >= 199711L
21722173
struct proxy_cast_context {
@@ -2273,7 +2274,7 @@ struct proxy_typeid_reflector {
22732274

22742275
namespace skills {
22752276

2276-
#if __STDC_HOSTED__ && __has_include(<format>)
2277+
#if __STDC_HOSTED__ && __cpp_lib_format
22772278
template <class FB>
22782279
using format =
22792280
typename FB::template add_convention<details::format_dispatch,
@@ -2283,7 +2284,7 @@ template <class FB>
22832284
using wformat =
22842285
typename FB::template add_convention<details::format_dispatch,
22852286
details::format_overload_t<wchar_t>>;
2286-
#endif // __STDC_HOSTED__ && __has_include(<format>)
2287+
#endif // __STDC_HOSTED__ && __cpp_lib_format
22872288

22882289
#if __cpp_rtti >= 199711L
22892290
template <class FB>
@@ -2604,7 +2605,7 @@ struct weak_dispatch : D {
26042605
// == Adapters (std::formatter) ==
26052606
// =============================================================================
26062607

2607-
#if __STDC_HOSTED__ && __has_include(<format>)
2608+
#if __STDC_HOSTED__ && __cpp_lib_format
26082609
namespace std {
26092610

26102611
template <pro::v4::facade F, class CharT>
@@ -2635,7 +2636,7 @@ struct formatter<pro::v4::proxy_indirect_accessor<F>, CharT> {
26352636
};
26362637

26372638
} // namespace std
2638-
#endif // __STDC_HOSTED__ && __has_include(<format>)
2639+
#endif // __STDC_HOSTED__ && __cpp_lib_format
26392640

26402641
#undef PROD_UNREACHABLE
26412642
#undef PROD_NO_UNIQUE_ADDRESS_ATTRIBUTE

include/proxy/v4/proxy.ixx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ using v4::weak_proxy;
4141

4242
namespace skills {
4343

44-
#if __STDC_HOSTED__ && __has_include(<format>)
44+
#if __STDC_HOSTED__ && __cpp_lib_format
4545
using skills::format;
4646
using skills::wformat;
47-
#endif // __STDC_HOSTED__ && __has_include(<format>)
47+
#endif // __STDC_HOSTED__ && __cpp_lib_format
4848

4949
#if __cpp_rtti >= 199711L
5050
using skills::direct_rtti;
@@ -60,10 +60,10 @@ using skills::slim;
6060

6161
} // namespace pro::inline v4
6262

63-
#if __STDC_HOSTED__ && __has_include(<format>)
63+
#if __STDC_HOSTED__ && __cpp_lib_format
6464
export namespace std {
6565

6666
using std::formatter;
6767

6868
} // namespace std
69-
#endif // __STDC_HOSTED__ && __has_include(<format>)
69+
#endif // __STDC_HOSTED__ && __cpp_lib_format

0 commit comments

Comments
 (0)