<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58406>58406</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
no warning for unused std::error_code
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Trass3r
</td>
</tr>
</table>
<pre>
```cpp
#include <system_error>
void foo()
{
std::error_code ec;
}
```
The code does get optimized away as system_category() is [[gnu::const]] but there is no -Wunused warning.
https://godbolt.org/z/M68ToY78b
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUMtu2zAQ_BrqQkTgQ5LFAw9x3dxyM1D0FJDiWmJAiwIfMZyvLy3JKFCUGEq72OXMYLQ3d4k6smFYFkROiLwixu08uGwAI_4j3mOC6weE4APiP7eVL28NvniPWI-Y2J8djluBy4nJIP5asL77GHwhgwHx43P3tBdP9a09T4DXXeMh4hES9kuyV_sNBqubumMV8W5oUAlGH-6bBWwjRu2xYJzzpjz4OSbUngqwzgmnCQI89maPX37lOcdCelNhtvNY727W75TSEh8c7K1g9EZ7l2ofxtJ9l_ve9Wf_-9DrCiTtuo6QTvSiMpIbwYWqkk0OZFHZyUtQAe96_8mlysHJfzRtmrKuB38tjXNfz9_LEvwnDKm0NsYMsRRt35CumqSgTQdACeMtb0nLaNso2na6GURDGYjKKQ0uykdKjM1wwytFqUtAlZWMMEYJPVDacCLqvlHiovpekAvV2jDUELgq6-qHj0cYVZCrJZ3HWIbOxhT_DlWMdpwBVrnCr3KafJDnUAY8VKu0XK3_AfHFxLA">