On 2012-05-18 17:11, Maxim Fomin <[email protected]> wrote:

Changing template parameter to Bar.f or bar.f affects value of bar.f.data. Seems to be a bug.

It's a bug. Further reduction:

import std.stdio;

mixin template Foo() {
  string data = "default";
}

struct Bar {
  mixin Foo f;
}

string get_data(alias unused, T)(T obj) {
    return obj.f.data;
}

void main() {
  Bar bar = Bar("");

  writeln(get_data!Bar(bar));
  writeln(get_data!(Bar.f)(bar)); // This line fucks things up.
  assert( get_data!Bar(bar) == get_data!(Bar.f)(bar) );
}

Note also that moving the marked line above the line before it
makes the assert pass. However, the writelns will both print the
wrong value ("default").

--
Simen

Reply via email to