https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87921
Bug ID: 87921 Summary: Incorrect error "storage size of [array] isn't known (when it is) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cuzdav at gmail dot com Target Milestone: --- I'm getting an error for what I believe to be valid code. Here's a complete, minimal example to reproduce it: // ================================ template<class H> struct X { static constexpr long Ary[] = { 1L }; long foo() { return Ary[0]; } }; void f() { class L{}; X<L> foo{}; } // ================================ https://godbolt.org/z/2tGwxo #1 with x86-64 gcc (trunk) <source>:3:27: error: storage size of 'X<f()::L>::Ary' isn't known 3 static constexpr long Ary[] = { 1L }; ^~~ Clearly the size of the array should be known. - locally, on both mac and linux I see same results - in g++6.3, C++17 mode it compiles - in 7.3 and all versions up through 8.2 and the trunk, in C++ 17 mode it does not compile. - in clang++, it compiles. - moving the function-local class L to file-scope fixes it. - moving the array outside of the template class fixes it. - explicitly providing a size to the array declaration fixes it.