https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85873
--- Comment #6 from Kimon.Hoffmann at lawo dot com --- Thanks for investigating this report and clarifying the underlying issue! I was afraid that this was a case of UB, but was misled by the cited standard section that mentioned lifetime extension of the underlying array. The situation as it stands is unfortunate though, since the standard does not allow "static constexpr" variables in constexpr functions. Therefor I don't see a standards compliant way to: return a constant array from a function (the choice of which array to return possibly depending on a function argument) that: * Provides type erasure on the length of the returned array. * Works in constexpr contexts. * Does not copy values during runtime. Anyway, thanks again for clarifying and I welcome the newly introduced warning as it will probably catch a few usage errors that would be hard to find otherwise.