https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90085
Bug ID: 90085 Summary: c++17 template argument deduction results in missed optimization Product: gcc Version: 8.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: s1445051 at mail dot zih.tu-dresden.de Target Milestone: --- Created attachment 46164 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46164&action=edit test case When deducing template arguments of a constexpr std::array, all the elements (strings in the test case) are stored in the data section, regardless if there are used in the program or not. Without template argument deduction only the accessed elements are stored in the data section. Template argument deduction somehow prevents the reduction of the constants. https://godbolt.org/z/q_COuU