Closed zmodem closed 1 year ago
Providing a float value for a %f conversion with printf is allowed since it will get promoted to double, but that doesn't work with this template function.
"Default argument promotion", IIRC, is not applied for template functions. Do you mean that we should treat them as variadic functions?
Duplicate of https://github.com/llvm/llvm-project/issues/59824
@apple-fcloutier's 92edd74b37c7a96b1d47dc67cda7f92b65066025 made it possible to put
__attribute__((format))
on variadic templates.In https://crbug.com/1472532 @pkasting raised an interesting point that because arguments to such templates don't undergo the same promotion that arguments to the regular printf/scanf varargs do, the warning becomes more aggressive https://godbolt.org/z/ajE5cYhKM:
Providing a float value for a
%f
conversion with printf is allowed since it will get promoted to double, but that doesn't work with this template function. And there doesn't seem to be any good way of working around the warning!Perhaps -Wformat needs to be relaxed somehow for this case?