You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attached is an example test for format-test.cc which reproduces the issue.
The UserDate class is the same as the 'date' example given in the docs, with two additions to silence C++14 compatibility warnings when built as a test.
These are:
Add a -> decltype(ctx.begin()) to parse and format to avoid a "deduced return types are a C++14 extension" warning from clang.
Declare parse as const to avoid a "constexpr non-static member function will not be implicitly 'const' in C++14" warning from clang.
If the user-defined type is constructed as an argument then both fmt::format and fmt::format_to succeed with or without FMT_STRING validation.
If an existing instance of the user-defined type is passed as an argument then fmt::format succeeds with or without FMT_STRING validation.
If an existing instance of the user-defined type is passed as an argument then fmt::format_to succeeds without FMT_STRING validation.
If an existing instance of the user-defined type is passed as an argument then fmt::format_to fails to compile with FMT_STRING validation.
The error case is #if'd out. Turn off and the test will compile and pass, turn on and it will fail to compile.
This is using Xcode 11.3.1, where clang reports itself as:
$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
fmt::format_to can use FMT_STRING to validate the format string, while formatting to a fmt::memory_buffer to avoid allocating a std::string.
This works successfully for built-in types but fails to compile for user-defined types with a 'call to deleted constructor of' error (Xcode 11.3.1).
The text was updated successfully, but these errors were encountered: