https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97645
Bug ID: 97645 Summary: Rejects valid subscript expression on array of unknown bound in constant expression Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: leni536 at gmail dot com Target Milestone: --- version: g++ (Compiler-Explorer-Build) 11.0.0 20201029 (experimental) g++ rejects the following program in -std=c++20: constexpr int foo(const int (&arr)[]) { return arr[1]; } constexpr int bar(const int (&arr)[10]) { return foo(arr); } constinit auto x = bar({}); https://godbolt.org/z/Mq1GGf This was possibly impossible prior to C++20 to subscript an array of unknown bound in constexpr context. As of P0388 conversion from T[N] to T[] can happen in constexpr context.