May 09, 2017 [Issue 17387] static struct this(ref) not pure | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17387 ag0aep6g@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |ag0aep6g@gmail.com Resolution|--- |INVALID --- Comment #1 from ag0aep6g@gmail.com --- You have to mark the constructor as `pure`: struct S { this(ref int val) pure { ++val; } } Attributes are only inferred under special circumstances. You generally have to be explicit with them. Closing as invalid. Please reopen if I'm missing the point. -- |
May 12, 2017 [Issue 17387] static struct this(ref) not pure | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17387 --- Comment #2 from Nick Treleaven <nick@geany.org> --- Yes, thanks. What I was confused by was actually when the struct is defined inside the unittest with the static keyword - pure is not inferred. Non-static nested struct inference works, it seemed weird that adding static prevents inference. But obviously the compiler treats it the same as the code in comment 0. -- |
Copyright © 1999-2021 by the D Language Foundation