serge-sans-paille added a comment.

In D124038#3504371 <https://reviews.llvm.org/D124038#3504371>, @efriedma wrote:

> I think you're looking at old documentation?  Here's what the current page 
> (https://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html) has to say:

Indeed! I was looking at my local Info Page. thanks for the extra pointer.

>> As an optimization, G++ sometimes gives array compound literals longer 
>> lifetimes: when the array either appears outside a function or has a 
>> const-qualified type. If foo and its initializer had elements of type char 
>> *const rather than char *, or if foo were a global variable, the array would 
>> have static storage duration. But it is probably safest just to avoid the 
>> use of array compound literals in C++ code.

I can quote that part instead. I don't think this invalidates the actual code, 
right? At least with that commit the observable behavior gets closer to GCC, 
and it fixes https://github.com/llvm/llvm-project/issues/39324


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124038/new/

https://reviews.llvm.org/D124038

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to