Consider the following code sample using fmtlib v11.1.4 or master
#define FMT_BUILTIN_TYPES 0
#include <cstdint>
#include <fmt/format.h>
int main() {
long n(1234);
fmt::print("1234!={}", n);
}
The expected output of this is 1234!=1234 however when built and run using FMT_BUILTIN_TYPES=0 the results are 1234!=536895556 (your results will vary)
Note that changing long to int will resolve this
I'm hitting this issue on non-eabi (defines int32_t as long) but I can also create on x64 MSVC.
My understand is of this is that during argument processing custom.value and custom.format are set, but then basic_format_args::type detects as detail::type::int_type so then during formatting (visit) the wrong member of the union is used.
Consider the following code sample using fmtlib v11.1.4 or master
The expected output of this is
1234!=1234however when built and run using FMT_BUILTIN_TYPES=0 the results are1234!=536895556(your results will vary)Note that changing long to int will resolve this
I'm hitting this issue on non-eabi (defines int32_t as long) but I can also create on x64 MSVC.
My understand is of this is that during argument processing custom.value and custom.format are set, but then basic_format_args::type detects as detail::type::int_type so then during formatting (visit) the wrong member of the union is used.