On Monday, 16 July 2018 at 22:21:12 UTC, H. S. Teoh wrote:
On Mon, Jul 16, 2018 at 10:08:34PM +0000, Eric via Digitalmars-d-learn wrote:
[...]

It's not illegal per se, but a very, very bad idea in general, because in D, structs are expected to be int-like POD values that can be freely copied/moved around by the compiler. More specifically, when structs are passed into functions or returned from functions, they may be moved around. Which means internal pointers will wind up being wrong.

[...]

Moving doesn't seem to be the issue here. Despite of the ICE, this code shouldn't compile, unless "&this" is allowed at compile-time.

Reply via email to