[Bug c/115768] [C23] constexpr array of string literals not optimized

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 3 17:17:13 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to biggs from comment #3)
> 
> The unused names are optimized out here and string_view is simply a
> contiguous array of characters not pointers.

Nope, it is still an array of pointers (and lengths) pointer.

    static const struct array names = {._M_elems={{._M_len=3, ._M_str=(const
char *) "RED"}, {._M_len=5, ._M_str=(const char *) "GREEN"}, {._M_len=4,
._M_str=(const char *) "BLUE"}}};


More information about the Gcc-bugs mailing list