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

    <tr>
        <th>Summary</th>
        <td>
            C: _Static_assert doesn't work with NULL
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Demo here: https://godbolt.org/z/xh68h61zz

```
#include <stddef.h>

int main()
{
    _Static_assert(NULL == NULL, "");
    _Static_assert(((void*)0) == 0, "");
    _Static_assert(0 == 0, "");
}
```
Results in the following compiler error:
```
<source>:5:20: error: static_assert expression is not an integral constant expression
    _Static_assert(NULL == NULL, "");
                   ^~~~~~~~~~~~
/opt/compiler-explorer/clang-12.0.1/lib/clang/12.0.1/include/stddef.h:89:16: note: expanded from macro 'NULL'
#  define NULL ((void*)0)
               ^
<source>:6:20: error: static_assert expression is not an integral constant expression
    _Static_assert(((void*)0) == 0, "");
                   ^~~~~~~~~~~~~~~
2 errors generated.
```

Clang doesn't like the `void*` cast for some reason. None of the recent (or trunk) versions work but GCC is totally fine with it.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VE1v2zAM_TXyhagh24mdHHxIk3aXoocNOxeyRdtaFSmQ5H79-lFO0qZFsGLFMJu2KYmkyMdnNVY-1xvcWhjQIStWMISw86Sw_Jqkt7KxOqTW9TR6oedpKBdDmb28ML5hfHV4l_wg-2FeKNPqUSKwYu2DlNilAyuuTn2UCbAVyrB8wfLlYaW63CtA192PIIJq74T36AKZ3f68uaGAGxKIOsvXwPJ8kiUr_uS6lwerJMspvSWn5xiK_0Uc_okTqzZnEfmOftTBgzIQBoTOam0flemhtdud0ugAnbMu4n4WUELRjq7FiGGxmtOT89itoxf400QBn3YOvVfWgPJgbABBmgnYO6FpT0Pm5tTsn6D-4WLzK1Z9Jge-XNsd7XV9ROOCMtPWoYtzWpj-IstTnmY01Ko5TtL3dfrAN9Le6LZaUH6rrIz4EAYTvSmwMBIldM5uiX-ts1RNtS-seqUvAMVQBmFf_Rn2nC07lnyuYeX_bNgXuf6V7r1vY76vzkOPBp0IKNPzbJ7e69hCkBY9HQFVAK3ucfo5yO6YfMmhFT7Q_-LA2y2CQ-GtSeHWUm9sN9k7bJGwoZrJKrjR3MeCH9BFnDw8WncPzRjg23odwQ02CK2fYWrvowoDqJAmsi7ksliKJKigsV7HFr1H9iTVKeTkGumRjE7XH45NWhublOgcGasfjp-LnbO_sI1UV96P6EmZz7JFlQx1kwkhy2zJ21JgVzZdWXWFrFA2oi1nWCVaNKh9zeaX1D2DjzCFiJ2cbxJV5zzPecFnPJvTnZL_oivLvCvn2SIjSsw40nGr05hHPM8TV08pNWPvaVErH_zbItWseoM4bUfxxRgG62rZCafxOUumvesp99_-_M01">