https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96716
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Slightly further reduced: struct string_view { constexpr string_view(const char* p) : p(p) { } const char* p; }; struct Foo { constexpr string_view getfoo() const { return {&foo}; } private: const char foo = 'c'; }; inline constexpr Foo foo; template <typename> struct Bar { static constexpr auto bar = foo.getfoo(); }; auto& baz = Bar<int>::bar;