https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71534
Bug ID: 71534 Summary: Initializing a static constexpr data member of a base class by using a static constexpr data member of a derived class should be an error Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: michele.caini at gmail dot com Target Milestone: --- Consider the following code: template<typename T> struct S { static constexpr int bar = T::foo; }; struct U: S<U> { static constexpr int foo = 42; }; int main() { } GCC compiles it, but it shouldn't. The type T is not a complete type when bar is initialized. Here is a discussion on stackoverflow where reasons are discussed: http://stackoverflow.com/questions/37816186/initializing-a-static-constexpr-data-member-of-the-base-class-by-using-a-static Link to the standard (working draft) are provided as well in the discussion. Other compilers (mostly clang) correctly reject it.