March 14

Copying POD structs with new is currently harder than it needs to be. It would be easier if the following code were allowed to compile:

struct Example { int x, y; }

Example original = { 123, 456 };
Example* copyPtr = new Example(original); // copies original onto the heap

Currently, this code fails to compile, because Example does not have a copy constructor. The proposed behavior is that, because Example is a POD struct, it should not require a copy constructor—the compiler can simply generate code that performs a bit copy.

This was originally requested in 2014 in Bugzilla issue 12918. It came up again recently in DMD issue 20950, regarding placement new.

March 24

On Friday, 14 March 2025 at 23:50:53 UTC, Paul Backus wrote:

>

Copying [POD structs][1] with new is currently harder than it needs to be. It would be easier if the following code were allowed to compile:

[...]

Makes sense to me.