[Bug c/85948] printf format attribute warning line carat inaccurate
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 16 17:57:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85948
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2018-09-16
CC| |manu at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
This works for me with all versions I have tried starting with GCC 6.1 (only in
C). In GCC 8.1:
<source>:13:11: error: format '%s' expects argument of type 'char *', but
argument 2 has type 'int' [-Werror=format=]
str_fmt("%s %zu %s %s", d, str, str, d);
~^ ~
%d
<source>:13:15: error: format '%zu' expects argument of type 'size_t', but
argument 3 has type 'const char *' [-Werror=format=]
str_fmt("%s %zu %s %s", d, str, str, d);
~~^ ~~~
%s
<source>:13:21: error: format '%s' expects argument of type 'char *', but
argument 5 has type 'int' [-Werror=format=]
str_fmt("%s %zu %s %s", d, str, str, d);
~^ ~
%d
It doesn't work in C++.
More information about the Gcc-bugs
mailing list