https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768
--- Comment #7 from biggs at biggs dot xyz ---
(In reply to Andrew Pinski from comment #2)
> For C++ (well with GCC extensions obvious) this would be valid:
> ```
> static constexpr const char *names[] = {
> [CE_RED] = "RED",
> [CE_GREEN]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768
--- Comment #6 from Andrew Pinski ---
(In reply to biggs from comment #5)
> So the argument here is that C23's constexpr does not permit this
> optimization because it does not allow constexpr pointers other than nullptr?
No I am saying the fol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768
--- Comment #5 from biggs at biggs dot xyz ---
(In reply to Andrew Pinski from comment #4)
> (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 p
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768
--- Comment #4 from Andrew Pinski ---
(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 length
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768
--- Comment #3 from biggs at biggs dot xyz ---
(In reply to Andrew Pinski from comment #1)
> >The unused constexpr names aren't optimized out but the const*const ones are.
>
>
> They are different.
> In the constexpr case, you have an array of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768
--- Comment #2 from Andrew Pinski ---
For C++ (well with GCC extensions obvious) this would be valid:
```
static constexpr const char *names[] = {
[CE_RED] = "RED",
[CE_GREEN] = "GREEN",
[CE_BLUE] = "BLUE",
};
```
And gets optimized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115768
Andrew Pinski changed:
What|Removed |Added
Resolution|--- |INVALID
Status|UNCONFIRMED