Three legitimate bugs? (D1.061)

bearophile bearophileHUGS at lycos.com
Mon May 17 14:09:10 PDT 2010


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


More information about the Digitalmars-d-learn mailing list