<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/141549>141549</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Clang] C11 `_Generic` matches anything with `void` in trunk build
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          fuhsnn
      </td>
    </tr>
</table>

<pre>
    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
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyslE-PmzAQxT_NcBltZAbswIEDAbHXSu2lp5XBDrh1TIrN_umnr0zSblttpa0UyRJCML_3xvY86b0ZndYV8APwNpFrmOalOq6Tdy7pZ_VSfZo0-iCDGVB6r5fgsdd2fsKjNBafTJjwvmlQOoWNlW5EyBrIWiQG1GC_BjxL79E4vJ9VP9uAYVnd161giAV3lOJxmU_Y6t5Ih86MU7AvuOjzDKwGwa6L1Q8fNyMPFyNARYqQtVHt4V47vZgBqAAqjAtAJcPo4HE2CiGrMQUqgRog2lYJ2eE_kEc7y5tDIwaovjU2ts8POfA2lu4PsG_fQX9LIH9DIKefsMjK40sUzGqk97mmf0JfOX8I3NLsrQy-5em3m3q96_HnKYSzh6wG6oC68fJhNy8jUPcdqJt0-fx5-fD8LVFVpsqslImu0n1eZCQKIZKpyvt9IZTke86HQaWS50IWShEvB5EeiyExFTHijNOeCUqZ2IleEytSJXSZa8UIcqZP0tidtY-nqJ0Y71ddpXnK8zKxstfWbyFAtA1l7Iu3yVLFgrt-HT3kzBof_CsimGC35NjmHniLTZoiCPZr2wTDkwzDpD1K9xIm48ZLYoBg25kIFoPhEgj9aqxK1sVWf-2YCdPa74b5BNRF8evj7rzMX_QQgLqtGQ_UXft5rOhHAAAA___UYWTK">