On Mon, 02 Apr 2012 12:22:16 +0200, Simen Kjaeraas <[email protected]> wrote:

On Mon, 02 Apr 2012 12:07:38 +0200, simendsjo <[email protected]> wrote:

On Mon, 02 Apr 2012 10:56:41 +0200, simendsjo <[email protected]> wrote:


The documentation explicitly says it shouldn't work for other than static members though.
http://dlang.org/traits.html#getMember

http://d.puremagic.com/issues/show_bug.cgi?id=7809

struct Foo {
     int n;
}

void main( ) {
     static assert(is(typeof(Foo.n) == int));
}

Yup, it compiles. Mayhap it shouldn't, but it does. Of course, trying
to use it for anything but typeof gives you an error. From this we can
conclude that either this behavior is also buggy, or getMember should
work that way.

It's convenient that it works this way.
Probably a change that didn't get reflected to the documentation.

Reply via email to