<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59824>59824</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Incorrect -Wformat type warnings with non-variadic functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sapphyrus
      </td>
    </tr>
</table>

<pre>
    This piece of code produces an incorrect warning when compiled with `-Wformat`: 
```cpp
template <typename... Args>
__attribute__((__format__(__printf__, 1, 2)))
void my_format(char const *format, Args... args);

void foo()
{
        float x = 0.f;

        my_format("%f", x);
}
```
```
<source>:9:18: warning: format specifies type 'double' but the argument has type 'float' [-Wformat]
        my_format("%f", x);
                   ~~   ^
 %f
```
Meanwhile, defining `my_format` as a variadic function results in no warning, as expected:
```cpp
__attribute__((__format__(__printf__, 1, 2)))
void my_format(char const *format, ...);

void foo()
{
        float x = 0.f;

        my_format("%f", x);
}
```
It doesn't seem to be related to `my_format` being templated, defining it as `void my_format(char const *format, float f);` results in the same incorrect warning.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVE1vpDgQ_TXFpRRkzFdz4NDp3pbmsLeV9oiMXTRegY1sk04u89tXpkkyk8xKOa0GoaYL6uO9V1UW3uurIWqhfITynIg1jNa1XizL-OJWn_RWvbR_jdrjokkS2gGlVYSLs2qV5FEY1EZa50gGvAlntLnibSSD0s6LnkjhTYcRoWIPfw_WzSJAxSA_IrAzsGM0tlsuy_1NoHmZRCCE_BReFjJipjRN8eiuHvI_7k5dJ0Jwul8DdR3wA_BD193Tb3bXLU6bMETjhFn84cCb_d5SPFmtcH7Zo4Af5CgcSmt8QODH19enrXAEICIA3kD-uEN_TzNYu4HYU0P95tIMkxUBnxHyM7J0-BANrPkRAnAOvBy2xwmff6pWnz8o9mszP3m7OklRqvzYQH7MDlHuvTfx770c-oWkHjR5jDIj8FrZtZ8IeI39GjCMFDmvM5mAo3h32yhFLygf35pa7vBwv75ICz9f378jIpR7p3GL_BXVP0mY26gj4BMqGvQ2e1Cx99IVQ-FR4JNwWigtcViNDNoadOTXKXjUBo19E4efoj89LyQDKciP_zWk_-f8pWn6-43dt4DKkjfA64CeaMZgsSd0FHdXRetjJ3qK_Xldb_VT13SIwkPFvqzKneCwY63Yjx2Nk-vFTJ-PpjRRba6avBEJtVlV80POi6pOxrbkilVlLQ-yl1WVD3VOfMiyRvJiyApGiW454znLWJFlRcbqVHHW95yLQsmqkZWEgtEs9JRO09OcWndNtPcrtWVz4EUyiZ4mvx20nBu64fYxSl6eE9fGmId-vXoo2KR98O9Zgg4Ttd_eqLyu3H0fd2L-fswaax4-DbtPVje1YwiLjyPNL8AvVx3GtU-lnYFfYqn98bA4-w_JAPyyAfTALxuBfwMAAP__pjzX5A">