Greetings

Kindly take a look at the code below. I am using alias this with a function that returns by value. I believe in such cases the alias should not take affect when an instance of foo is being used as an lvalue. As a result elements of bar should not have been visible inside the constructor of foo.

Please comment. Is this a bug?

Regards
- Puneet

struct bar (bool B, N...) {
  int n = 0;
}

struct foo (N...) {
  bar!(true, N) _bar = void;
  
  bar!(true, N) getN() {
    return _bar;
  }

  alias getN this;

  public this(T) (T other)
    if (is(T unused : int)) {
    n = other;
  }
}


void main() {
  import std.stdio;
  foo!8 a = 42;
  writeln(a.n);
}