<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92665>92665</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
static_assert() condition cannot result in unsafe buffer access
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pkasting
</td>
</tr>
</table>
<pre>
In issue 92191 we discovered `-Wunsafe-buffer-usage` warns on conditions inside `static_assert`s despite the fact that they are not executed at runtime and thus cannot result in an unsafe buffer access. The following snippet demonstrates this.
```
void foo() {
int j[1] = {0};
static_assert(j + 1 != nullptr); // Erroneously warns
}
```
Live repro: https://godbolt.org/z/Y5onbr88W
@haoNoQ @jkorous-apple
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsks2K2zAQx59mfBkSZPn74MOGNFAohUJh6anI1jhWVpGMRkq6ffriJGzpdkFIjDQf_xn9FLM5OqIeqh1U-0ylOPvQLy-Ko3HHbPD6tf_s0DAnwk7mXY5XQm149BcKpBFqsXlOjtVEmyFNE4VNYnUkqAVeVXCM3uHonTbReMdoHBtNaxhHFc34UzFTiKuNmngxkTDOhJMaI8ZZrRu9ogqEzkekXzSmSBpVxJBcNGdC5TTGOTGOyq0-gTjZiMahcniXhndpqMaRmLf4fa3grfVX447IziwLRdR09o5jUJEY42x4C2IP4glq8Vg38-KNxsl7kC3IDqHZ3e8RjYt4gmqXQ7VHKPbrm4BmD8Wby79dy_aEIHeYI8h8DXDJ2iUGkB0UO0SQB5AH_BSCd-QT29f7UB-6mv2HAr-YC2GgJXgonnCOcWEonu65jl4P3satD0eQh98gDz8q74bQts-PXKWYlf_qvyGU4vTig0-8UctiKdN9obuiUxn1eZPXoqpK2WRzr7p2qoZC13qsxVBUioZWi6JtprJWumky00shS1Hlbd6Komy2ZVFWrS4mmYs8n9oWSkFnZezW2st51ZbdiOs7WddVZtVAlm-MSunoescRpFyRDf0asxnSkaEU1nDkv1miiZb69zNff-0Nyf-p-QiZLAXbv5ukiXMatqM_gzysFR_HZgn-RGMEebjpZJCHWx9_AgAA___ZBxg0">