[clang] [clang-tools-extra] [compiler-rt] [lldb] [Clang] [Sema] Make `-Wincompatible-pointer-types` an error by default (PR #157364)

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 17 07:22:36 PDT 2025


alexfh wrote:

This diagnostic fires in the following code - https://gcc.godbolt.org/z/G6sYcTnWc:
```
extern void f(struct stat*);
#include <sys/stat.h>
void g() {
    struct stat s;
    f(&s);
}
```

```
<source>:1:22: warning: declaration of 'struct stat' will not be visible outside of this function [-Wvisibility]
    1 | extern void f(struct stat*);
      |                      ^
<source>:5:7: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat *' [-Wincompatible-pointer-types]
    5 |     f(&s);
      |       ^~
<source>:1:27: note: passing argument to parameter here
    1 | extern void f(struct stat*);
      |                           ^
```
Is this expected?

https://github.com/llvm/llvm-project/pull/157364


More information about the cfe-commits mailing list