Issue 124869
Summary `__inline` causes header to fail to parse, when it succeeds in MSVC
Labels new issue
Assignees
Reporter wmmc88
    I was trying to parse a Windows header (`ufxclient.h`) using clang with the msvc compatibility flags (`-fms-compatibility -fms-extensions`) and ended up with the following error:
```
  error: 'inline' can only appear on functions
```

I managed to narrow the issue down to several typdef definitions in the header that erroneously add `FORCEINLINE` to a function ptr typedef. This is one of them:
```
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFQUEUE
FORCEINLINE
UFX_ENDPOINT_GET_COMMAND_QUEUE (
    _In_ PUFX_GLOBALS,
    _In_ UFXENDPOINT
    );
typedef UFX_ENDPOINT_GET_COMMAND_QUEUE *PFN_UFX_ENDPOINT_GET_COMMAND_QUEUE;
```
MSVC successfully compiles this definition, but clang fails with the above error, even with all the ms compatibility flags/extensions enabled. I think clang should loosen this error to a warning so that the code still compiles. Or should allow this completely when the ms-compat options are enabled.

Minimal repros :

Passing in MSVC: https://godbolt.org/z/59MYbebax
Hard Error in Clang: https://godbolt.org/z/W8cs54oo6
Warning in Gcc, but still succeeds to compile: https://godbolt.org/z/Tbv7PsbKr


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to