Issue 141549
Summary [Clang] C11 `_Generic` matches anything with `void` in trunk build
Labels clang
Assignees
Reporter fuhsnn
    The static asserts below fail with GCC and Clang <= 20, but pass in Godbolt trunk and clang-21 from Debian nightly repo
```
_Static_assert(1 == _Generic((int)0 , void : 1),"");
_Static_assert(1 == _Generic((float)0 , void : 1),"");
_Static_assert(1 == _Generic((void*)0 , void : 1),"");
_Static_assert(1 == _Generic((int[4]){}, void : 1),"");

_Static_assert(4 == _Generic(42, void: 4, int: 2),"");
_Static_assert(2 == _Generic(42, int: 2, void: 4),"");

_Static_assert(4 == _Generic(42, void: 4),"");
_Static_assert(2 == _Generic(42, int: 2),"");
```
Godbolt: https://godbolt.org/z/he9xYrPxq
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to