// 202207 P2286R8 Formatting Ranges
// 202207 P2585R1 Improving default container formatting
// LWG3750 Too many papers bump __cpp_lib_format
- no_stdname = true; // TODO remove
values = {
- v = 1; // TODO 202207
+ v = 202207;
cxxmin = 23;
hosted = yes;
};
#if !defined(__cpp_lib_format_ranges)
# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED
-# define __glibcxx_format_ranges 1L
+# define __glibcxx_format_ranges 202207L
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format_ranges)
+# define __cpp_lib_format_ranges 202207L
# endif
# endif
#endif /* !defined(__cpp_lib_format_ranges) && defined(__glibcxx_want_format_ranges) */
using std::format_to_n;
using std::format_to_n_result;
using std::formatted_size;
-// FIXME __cpp_lib_format_ranges
-#if __cplusplus > 202002L
+#if __cpp_lib_format_ranges
using std::formattable;
#endif
using std::formatter;
using std::wformat_context;
using std::wformat_parse_context;
using std::wformat_string;
-// FIXME __cpp_lib_format_ranges
-#ifdef __glibcxx_format_ranges
+#ifdef __cpp_lib_format_ranges
using std::format_kind;
using std::range_format;
using std::range_formatter;
std::format(L"{}", "hello"); // { dg-error "here" }
std::format(L"{}", std::string_view("hello")); // { dg-error "here" }
std::format(L"{}", std::string("hello")); // { dg-error "here" }
-#ifdef __glibcxx_format_ranges
+#ifdef __cpp_lib_format_ranges
// LWG 3944 does not change this, it's still valid.
std::format(L"{}", std::vector{'h', 'e', 'l', 'l', 'o'});
#endif
}
}
-#if __glibcxx_format_ranges
+#if __cpp_lib_format_ranges
constexpr bool escaped_strings_supported = true;
#else
constexpr bool escaped_strings_supported = false;
--- /dev/null
+// { dg-do preprocess { target c++23 } }
+
+#include <format>
+
+#ifndef __cpp_lib_format_ranges
+# error "Feature-test macro __cpp_lib_format_ranges missing in <format>"
+#elif __cpp_lib_format_ranges != 202207L
+# error "Feature-test macro __cpp_lib_format_ranges has wrong value in <format>"
+#endif
VERIFY( ! is_format_string_for("{} {0}", 1) );
}
-#if __glibcxx_format_ranges
+#if __cpp_lib_format_ranges
constexpr bool escaped_strings_supported = true;
#else
constexpr bool escaped_strings_supported = false;