https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90205

--- Comment #2 from Jonny Grant <jg at jguk dot org> ---
(In reply to Andreas Schwab from comment #1)
> %f is correct for double.

Yes, the float was promoted to double via the ellipsis ... as I understand it
(default type promotion - I am sure you know a lot more about this than I do),
but the message should say 'float' like the following I thought?

The 'argument' is float, within the printf it arrives as a 'parameter' of type
double after the promotion before the call.

I guess what I am saying, is the message should state the type before the
promotion?  Clang does it as I expect

I expected:
<source>:5:14: warning: format '%d' expects argument of type 'int', but
argument 2 has type 'float' [-Wformat=]

    5 |     printf("%d", i);
      |             ~^   ~
      |              |   |
      |              int float
      |             %f

Reply via email to