On Wednesday, 18 July 2018 at 11:35:40 UTC, baz wrote:
On Wednesday, 18 July 2018 at 11:27:33 UTC, baz@dlang-community
wrote:
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.
still with .init() trick this works, so im' not super sure...
NVM the .init() trick. Specs are clear : it's a global so it's
evaluated at compile time
(https://dlang.org/spec/declaration.html#global_static_init)
Example code should not compile.