https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71258
Bug ID: 71258 Summary: Missed optimizations: dynamic allocation, virtual calls, empty destructors Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rureclonic at thraml dot com Target Milestone: --- clang: https://godbolt.org/g/IjYT24 gcc: https://godbolt.org/g/nkGVdB It would seem gcc is not able to eliminate the calls to new, the virtual call to concept::magic and the destructors, while clang completely optimizes out the program. interesting variation: https://godbolt.org/g/2ic8qL Interleaving the construction of polys with the additions produces an output with no virtual calls to concept::magic, yet without eliminating the calls to new and destructors.