[Bug c++/85873] [8/9 regression] GCC omits array constant in .rodata causing a segmentation fault.
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jun 3 20:55:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85873
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Kimon.Hoffmann from comment #6)
> 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.
It does seem wrong that a constexpr function can't define a constexpr static
local variable.
More information about the Gcc-bugs
mailing list