https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104105
Bug ID: 104105 Summary: Unused nothrow new not optimized Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- g++ can remove new calls when the result is unused, but fails to di the same with nothrow new calls. f() could be compiled to an empty function with optimisations on. ------------ void f() { new (std::nothrow) int(5); new (std::nothrow) int[5]; } ------------