[clang] [C23] Fix typeof handling in enum declarations (PR #146394)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 3 07:41:09 PDT 2025
AaronBallman wrote:
> > let's handle C++ separately to keep the patch reasonable?
>
> ~What about Objective-C then?~
>
> ```c
> void f() {
> ^ typeof((void)0) {}; // Ok
> ^ typeof(void) {}; // Error but should probably be ok
> }
> ```
>
> But yeah, doing all of that in this pr might be too much—unless the changes you’ve already made happen to already fix these cases.
C++ cases are not changed by this patch, but the Objective-C ones are:
```
F:\source\llvm-project>llvm\out\build\x64-Debug\bin\clang.exe -cc1 -fsyntax-only -fblocks -x objective-c "C:\Users\aballman\OneDrive - Intel Corporation\Desktop\test.cpp"
C:\Users\aballman\OneDrive - Intel Corporation\Desktop\test.cpp:2:5: warning: expression result unused [-Wunused-value]
2 | ^ typeof((void)0) {}; // Ok
| ^~~~~~~~~~~~~~~~~~~~
C:\Users\aballman\OneDrive - Intel Corporation\Desktop\test.cpp:3:5: warning: expression result unused [-Wunused-value]
3 | ^ typeof(void) {}; // Error but should probably be ok
| ^~~~~~~~~~~~~~~~~
2 warnings generated.
```
So good call on adding test coverage there.
https://github.com/llvm/llvm-project/pull/146394
More information about the cfe-commits
mailing list