Zig vs D generics

Quirin Schroll qs.il.paperinik at gmail.com
Mon Oct 10 16:55:14 UTC 2022


On Monday, 10 October 2022 at 16:27:11 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 10 October 2022 at 14:18:52 UTC, Paulo Pinto wrote:
>> I guess you did something wrong, :)
>
> Didn't work in clang for me… but good to know that it is 
> supposed to work.

I was rather sure it was supposed not to work. There is 
`constexpr new` in C++20, but memory allocated with it must be 
`constexpr delete`’d. Could be that GCC’s `std::string` does not 
allocate memory for initializing the string with a literal, but 
Clang does.

My advice: Don’t rely on GCC’s behavior.


More information about the Digitalmars-d mailing list