https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92062
Bug ID: 92062 Summary: ODR-use by static_assert ignored for static member of class template Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: herring at lanl dot gov Target Milestone: --- The following program throws during static initialization iff A<0>::x is instantiated, which it must be because of the static_assert (which is itself eagerly "instantiated" along with the class). template<int> struct A { static const bool x; static_assert(&x); // odr-uses A<...>::x }; template<int I> const bool A<I>::x=(throw 0,false); void f(A<0>) {} // A<0> must be complete, so is instantiated int main() {} GCC 8.3.0 produces the expected result, but 9.1.0 does not initialize the variable.