https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109185
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Keywords|lto |link-failure Last reconfirmed| |2023-03-18 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. Also fails with linking this: ``` template<int &R> struct A { static constexpr int &value = R; }; template<typename = void> auto S() { static int s; return A<s>{}; } auto &s = decltype(S())::value; int main(void) { return s; } ``` So a front-end issue. Most likely not marking S<void>::s as being used. Note instead of `decltype(S())::value`, I do `S().value`; it works.