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] = "GREEN", > [CE_BLUE] = "BLUE", > }; > ``` > > And gets optimized way. > > But for C23, constexpr pointers have to be null. > > In the original testcase you refer to `&name[0][0]` as you pass to puts. > Since you take the address of name, it still needs to be a variable. Replied to the wrong comment. You are saying I really want: ```cpp #include <iostream> enum struct Color { RED, GREEN, BLUE }; int main() { static constexpr const char* names[] = {"RED", "GREEN", "BLUE"}; std::puts(names[static_cast<std::size_t>(Color::RED)]); } ``` But this isn't possible in C23 because we can't initialize constexpr pointers to static objects. We can only initialize them to nullptr