| Issue |
109959
|
| Summary |
[clang] False positive clang-diagnostic-format with long format specifier on Windows
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
chrchr-github
|
~~~c++
#include <cstdio>
enum E : unsigned { E0, E1 };
int f(const char* c) {
E e;
return sscanf(c, "%lx", &e);
}
~~~
~~~
.\foo.cpp:7:29: warning: format specifies type 'unsigned long *' but the argument has type 'E *' [clang-diagnostic-format]
7 | return sscanf(c, "%lx", &e);
| ~~~ ^~
| %x
~~~
The warning goes away if `E`'s base type is `unsigned long`, but `long` types are also 32bit on Windows.
There also is no warning for e.g. a typeless enum and `%x`.
If the warning is (correctly) triggered by a size mismatch, this should be stated in the error message.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs