https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
--- Comment #7 from James Y Knight ---
On the libc++ side, a suggestion was given that instead of making this an
_error_, we could instead emit a warning if "a constexpr or constinit object is
a basic_string or contains a basic_string
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
--- Comment #6 from Arthur O'Dwyer ---
(In reply to James Y Knight from comment #5)
> > Does using __builtin_is_constant_p on the union member not work?
>
> I've created a proof-of-concept patch for libc++ to support SSO strings
> during
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
--- Comment #5 from James Y Knight ---
> Does using __builtin_is_constant_p on the union member not work?
I've created a proof-of-concept patch for libc++ to support SSO strings during
constant evaluation. It works.
If everyone disagrees with
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
--- Comment #4 from James Y Knight ---
vector and string are different in one key way: a zero-sized vector has no
accessible storage, while a zero-sized string has 1 byte of readable storage --
the NUL terminator. Because of that, I don't think
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
--- Comment #3 from Jonathan Wakely ---
Does using __builtin_is_constant_p on the union member not work?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
Jiang An changed:
What|Removed |Added
CC||de34 at live dot cn
--- Comment #2 from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111351
--- Comment #1 from Arthur O'Dwyer ---
(Author of the blog post here.)
In contrast to James' view, I think the libstdc++/MSVC behavior is relatively
easy to explain; I think libc++'s `if consteval` approach is baroque and
confusing. [That is,