https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79398
Bug ID: 79398 Summary: misleading error static constexpr member function called in a constant expression before its definition is complete Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- The error below is a bit confusing: the definition of B::bar() is complete when it's called. I think I understand that the reason for the error below is actually that the function is called before the definition of the class of which it's a member is complete. The error should make that clear, although it seems that accepting it (e.g., as an extension) would make static constexpr member functions quite a bit more useful. $ cat y.C && gcc -S -Wall -Wextra -Wpedantic y.C struct A { static constexpr int foo () { return 1; } }; struct B: A { static constexpr int bar () { return 2; } enum E { e = B::foo () }; enum F { f = B::bar () }; }; y.C:8:23: error: ‘static constexpr int B::bar()’ called in a constant expression before its definition is complete enum F { f = B::bar () }; ~~~~~~~^~ y.C:8:24: error: enumerator value for ‘f’ is not an integer constant enum F { f = B::bar () }; ^