AaronBallman wrote:

> Since you aren't diagnosing reinterpret-casting a function pointer from 
> `void*`, because this would warn on idiomatic POSIX code (`dlsym` returns 
> `void*`), it seemed to me that you'd be interested in not warning on 
> idiomatic Windows code (`GetProcAddress` returns `FARPROC`.)
> 
> But perhaps I was mistaken.

The idiomatic code doesn't diagnose?
```
#include <Windows.h>

typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);

int main() {
  HMODULE hLib = LoadLibrary("kernel32");
  PGNSI Ptr = reinterpret_cast<PGNSI>(GetProcAddress(hLib, 
"GetNativeSystemInfo"));
}
```
I get no diagnostics from this when I test on Windows, so I feel like I must be 
missing something.

https://github.com/llvm/llvm-project/pull/86131
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to