Formatting a std::optional<T> where T had a custom format_as(T) function failed to compile with clang,
due to set_debug_format being hidden by private inheritance. This fix makes the function available through a using clause.
This resolves the following finding reported by Coverity Static Analysis
v2023.6.1 on line 1964 of fmt/include/fmt/format.h:
ptr_arith: Using &v as an array. This might corrupt or misinterpret
adjacent memory locations.
* Namespace-qualify to avoid ambiguity with std::format_to for format-test.cc
When build fmt with MSVC under option /std:c++latest, it failed due to `error 2668: 'std::format_to': ambiguous call to overloaded function`, so add namespace to qualify the call to format_to to avoid this issue.
* fix: make std::bitset formattable again
It used to be formattable via operator<<(ostream&) implicitly. Make it
formattable again, but this time via formatter specialization.
* fix: make nested_formatter constexpr default constructible
2dd4fa8742 removed all usage of __std_stream because
it is no longer available with clang v17. That commit missed one place
where the header was still used (only used when building with -DFMT_MODULE=ON).
Remove it there too.
See #3654
* Workaround intel bug
Potential workaround / restructure for the intel bug that is the cause of #3645.
Make the variable in the external struct instead an embedded static constexpr variable in the only function that uses the variable.
* Finish the proposed change -- remove struct accessor
* Refactor proposed intel fix.
Moved variable out of function to avoid specialization on Float. Made it a separate function that is called from format_float.
* Fix incorrect function name.
* Add missing inline.
Because it's just performing a very basic type conversion that can be
done at constexpr time.
My use case simultaneously creates a
`fmt::basic_format_string<some_type_conversion<Args...>>` instance and
performs `some_type_conversion<Args>(args)...`. `some_type_conversion`
optionally applies `fmt::streamed(arg)` to a subset of types. This needs
to be `constexpr` because `basic_format_string`'s constructor is
`consteval`.
* Avoid a space in the UDL definition except on GCC before 4.9
Clang 18 has grown a warning about the space being deprecated which
is enabled by default in their nightly binaries. However GCC before 4.9
will reject the UDL definition unless there is a space there, so we need
to keep the space conditionally for it.
* Remove UDLs on GCC before 4.9 to simplify things
GCC before 4.9 rejects the syntax that is now
rejected on more modern compilers.
* Disable compile-error-test on GCC < 4.9
This avoids the UDL tests failing as GCC < 4.9 can not parse UDLs
without a space, but the space is malformed in modern compilers.
With this, fmt can be used on Windows 98 and the Original Xbox with:
set(FMT_OS OFF)
It is not exposed as a CMake option but one can define it manually
in the fmt subproject, e.g.:
target_compile_definitions(fmt PUBLIC FMT_WINDOWS_NO_WCHAR)
Fixes#3631