https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
Bug ID: 114013 Summary: [14 Regression] Specializations of var templates no longer emitted since r14-8987 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- struct S { int a, b; }; template <int N> constexpr struct S var[16] = {}; template <> constexpr inline struct S var<6>[8] = { { 1, 1 }, { 2, 0 }, { 3, 1 }, { 4, 0 }, { 5, 1 }, { 6, 0 }, { 7, 1 }, { 8, 0 } }; [[gnu::noipa]] void foo (S) { } template <int N> void bar (int x) { foo (var<N>[x]); } volatile int x; int main () { bar <6> (x); } extracted from mesa no longer links starting with r14-8987-gdd9d14f7d53de07beff06004922a2bff20ece671 (-O0 or -O2, doesn't matter). /usr/bin/ld: /tmp/cc4Mqq20.o: in function `void bar<6>(int)': mesa.C:(.text._Z3barILi6EEvi[_Z3barILi6EEvi]+0x14): undefined reference to `var<6>' collect2: error: ld returned 1 exit status