Open
Description
Specifying a named argument in the format string but not providing a value does not result in a compilation error on recent GCC and Clang versions when the format string is compiled using FMT_COMPILE
.
This is the case both when the argument is missing altogether (1) and when it is present but no value is assigned (2).
When the FMT_COMPILE
macro is removed, both fmt::format
calls result in compilation errors.
#include <fmt/format.h>
#include <fmt/compile.h>
int main() {
using namespace fmt::literals;
fmt::format(FMT_COMPILE("{x}")); // 1
fmt::format(FMT_COMPILE("{x}"), "x"_a); // 2
return 0;
}
On Compiler Explorer: https://godbolt.org/z/4zGrofeoE