https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107292
Bug ID: 107292 Summary: no warning for unused std::error_code Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trass3r at gmail dot com Target Milestone: --- #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