On Friday, 8 June 2018 at 18:18:27 UTC, Jonathan M Davis wrote:
On Thursday, June 07, 2018 22:43:50 aliak via
Digitalmars-d-learn wrote:
On Thursday, 7 June 2018 at 21:32:54 UTC, Jonathan M Davis
wrote:
> [...]
Is that supposed to compile? -> https://run.dlang.io/is/SjUEOu
Error: cannot use non-constant CTFE pointer in an initializer
&[42][0]
Not necessarily. It's the pointer equivalent of what the OP did
with a mutable class reference, and I was using it for
demonstrative purposes. The mutable class reference case didn't
used to compile (it used to have to be immutable). This example
is just the logic of what happens if it's legal with pointers
too. If it hasn't been changed to be legal with pointers like
it has been with classes, then that's arguably a good thing.
- Jonathan M Davis
Boh, it seems it actually has, just not with primitive types it
seems:
struct A {
int i = 3;
}
struct B {
auto a = new A(3);
}
Above compile fine :o