June 16, 2014
https://issues.dlang.org/show_bug.cgi?id=12927

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> ---
In 2.063 and earlier, the code had been incorrectly accepted.

Bar.foos is an instance field, so cannot evaluate it without valid 'this' expression.

--
June 16, 2014
https://issues.dlang.org/show_bug.cgi?id=12927

--- Comment #2 from bearophile_hugs@eml.cc ---
(In reply to Kenji Hara from comment #1)
> In 2.063 and earlier, the code had been incorrectly accepted.
> 
> Bar.foos is an instance field, so cannot evaluate it without valid 'this' expression.

I see.

And is it right to reject this too:


alias TypeTuple(T...) = T;
struct Foo {
    int a;
    immutable int b;
}
__gshared foos = TypeTuple!(Foo(10, 20), Foo(10, 20));
struct Bar {
    void bar() {
        enum i = 1;
        enum r = foos[i].b;

    }
}
void main() {}

dmd 2.066alpha gives:

test.d(6): Error: static variable _foos_field_1 cannot be read at compile time

--