https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95686
Bug ID: 95686 Summary: undefined reference to static local variable within inline function Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: leni536 at gmail dot com Target Milestone: --- The following code produces an "undefined reference to `foo()::i'" linker error: template <const int* ptr> struct S { static constexpr const int* value = ptr; }; inline auto foo() { static const int i = 0; return S<&i>{}; } #include <iostream> int main() { std::cout << decltype(foo())::value; }