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

    <tr>
        <th>Summary</th>
        <td>
            [clang] consider not expanding macros for _Static_assert failures
        </td>
    </tr>

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

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

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

<pre>
    Compare clang-17 to gcc-13: https://godbolt.org/z/MEhGahGe9

clang:
```
<source>:49:12: error: static assertion failed due to requirement '__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0) == __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned int)(-1)) < (unsigned int)1)) * 0L)) : (int *)8))), (((unsigned int)(-1)) < (unsigned int)1), 0) || __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0) == __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned int)(-1)) < (unsigned int)1)) * 0L)) : (int *)8))), (((unsigned int)(-1)) < (unsigned int)1), 0) || (__builtin_choose_expr(!(sizeof(int) == sizeof (*(8 ? ((void *)((long)(a) * 0L)) : (int *)8))), 0, __builtin_choose_expr(__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0), a, 0) >= 0 && (a) <= (int)(long)2147483647)) || (__builtin_choose_expr(!(sizeof(int) == sizeof (*(8 ? ((void *)((long)(2147483648U - 0) * 0L)) : (int *)8))), 0, __builtin_choose_expr(__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned int)(-1)) < (unsigned int)1)) * 0L)) : (int *)8))), (((unsigned int)(-1)) < (unsigned int)1), 0), 2147483648U - 0, 0) >= 0 && (2147483648U - 0) <= (unsigned int)(long)2147483647))': min(a, 0x80000000u - 0) signedness error, fix types or consider min_unsigned() before min_t()
   49 |     return min(a, 0x80000000u - 0);
      | ^~~~~~~~~~~~~~~~~~~~~~~
```
gcc:
```
<source>: In function 'foo':
<source>:2:23: error: static assertion failed: "min(a, 0x80000000u - 0) signedness error, fix types or consider min_unsigned() before min_t()"
    2 | #define static_assert _Static_assert
      | ^~~~~~~~~~~~~~
```

I think if we did not expand the macros when printing the diagnostic, it would be more concise and clear to users what the problem was.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV8GO2zYQ_RrqMvCCGsqWdNDBkddBgPZU9GxQ1EhiI5MuSWU3OfTbC0pe72KzbpO2SLBoBEE0h-TjvMdnYCi9170hqtj6DVvvEjmFwbrKaPW-JS-n0WhyPmls-7Gq7fEkHYEapelXaQ7BQq_UKhVMbGEI4eSZ2DLcM9z3tm3sGG6s6xnuPzHc_3w7vJXDWyoZ3zG-Xb4zVFy0xDb8_C5dUXs7OUVM3DKxzUomtinGvcg56-IPH2TQCqT35IK2BjqpR2qhnShm5-j3STs6kgnAMD8cmkmPQZuDGqz1dKD7k2NYMCy8_kS2Y1hoExiWwMSOiR0sYZjnbBkWBTCxX7rFB6tbmMPlEhit6S-d5V3QGBardG4jcA2XgUsQt8B_uszYnmec0YtlYH5r-DrsGvgTOt9egMnM_mrharbPZvwrSf7hbg8i5TXL6-8g0g-XvD6XMCyu65T-51LJr2XL4-dahv9bi8dWPvH7beTGgeGG4QYuOos6xp9CnylhmuVZITZZ_rDTd3HDJY3iV1idubxeb7yif39sPxP_upteOqeLtz5P5IrJGOaR3FGbxaA18PuCL8_0gLtgGfL-XB1hDZ2-h_DxRB6sA2WN1y25iHN42HuWpISGOutoHglLaKnAACCbPQ7xcRQmZ_46DybeXJYCzE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