bearophile wrote:
Steven Schveighoffer:
No, I was simply wrong :) I think it's by design. Which means the original bug report is valid.

The original bug report is valid, but I don't understand that code still. Is 
the const implying a static only in some situations?

Why is this OK for the compiler:

struct Foo {
    const Foo f = Foo();
}
static assert(Foo.sizeof == 1);
void main() {}


While this is not OK for the compiler?

struct Foo {
    const Foo f;
}
static assert(Foo.sizeof == 1);
void main() {}

Bye,
bearophile

In D1, the two are totally different. The second one is the only situation in D1 where 'const' doesn't mean compile-time constant. I guess the same behaviour has been applied in D2, but I'm not sure if that's intentional or not.

Reply via email to