<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63096>63096</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy "misc-redundant-expression" false positive for static_assert() using alignof/sizeof
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
emezeske
</td>
</tr>
</table>
<pre>
This code triggers the misc-redundant-expression warning. The static_assert() is something I've used to catch bugs where struct X has fields added to it without the explicit alignment being updated (and this struct is shared memory with a GPU so I need to know when to go update struct definitions on the GPU side). So the static_assert does make sense, and works -- the clang-tidy warning even appears when the static_assert fails (so the two expressions are definitely not redundant)!
```
struct X alignas(32) {
int x;
};
static_assert(alignof(X) == sizeof(X));
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0k92uozYQx5_G3IwSgfk4cMHFbqNUe1epW2nvKoMHmAZs5BmSk336CkJyetRWshKPsX_zny_DTL1DrFX-VeWnyCwy-FDjhD-RLxg13t7r7wMxtN4iSKC-x8AgA8JE3B4C2sVZ4-SA73NAZvIObiY4cv0Rvg8ILEao_dMwYxClS6UrIAb2E8pArodvSr9dERZGC-KhNdIO0Cw9w23AsALC0gr8gMEwdISjZTDWPm6TwI1k8ItsmvB9HqklATNS7yZ0Ag2uTpbZGkELSpfGWZA1pB287gYT0MKEkw_3DQgGfv3tD2AP38Dhw9fF-duqya1G73fmE2OxI0dC3jF4t6nZCGRR6eoIv_vt7FM6wHpkmMwFgdExKv0LrPJuPlwYDoftRTsa1x-E7P2ZWMArOjDzjCbwruhf6M7QyGu8_HAsNw8fNWIwAZ-acbyD8wKvYipdKZ2o-KTiL_tvEe9rM1812fJsWOky1Wtl1dvXxw0AcgLvKt1t9Xb62O-Mz42xoXyndPljI6UnlZ6A6Se-Dtf1gjwVRbZObZVWJsI6Kcq8TKosy6OhNkln0yZrkxaTsmiSOI2zKu9yzIq403kbUa1jncZFnCZVEmf5UVubpTrWbwVilpWNymKcDI3HcbxORx_6iJgXrIs0ropoNA2OvI2O1g5vsH1UWq-TFOr1zWHtY5XFI7HwB0VIRqz_UVil9f-Ok9IaOjMywuyZhK4InQ__OVcLr93xSuT5kbxoCWM9iMys0i9Kn5U-9yTD0hxbPyl9XmXtf4c5-L-wFaXPWzCs9HkL9u8AAAD__yW1YTI">