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

--- Comment #5 from Marat Radchenko <marat at slonopotamus dot org> ---
So, does "String literals, and compound literals with const-qualified types,
need not designate distinct objects." apply here or not? If not, how does the
case where it applies look like?

https://en.cppreference.com/w/c/language/compound_literal explicitly says
(though I do understand this is not a 100% reliable source):

Compound literals of const-qualified character or wide character array types
may share storage with string literals.

----
(const char []){"abc"} == "abc" // might be 1 or 0, implementation-defined
----

Comparison with string literals isn't actually implementation-defined but
instead unspecified behavior, but the point here is that they think it is
possible memory is shared.

Reply via email to