On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
Here is my full code. Please take a look.
https://pastebin.com/av3nrvtT
The error has nothing to do with taking a pointer to `this`. It's
suggesting that somewhere in your code you're attempting to use
the `this` reference like an lvalue, e.g. making an assignment to
it. I don't see anywhere that you're doing that. Glancing through
the code, I don't see anywhere that you're doing that (and
unfortunately this is not a minimal example because of
dependencies on some of your other modules, so I can't compile it
myself).
What was the line number of the original error? Sometimes the
line number reported isn't where the error actually occurs. Also,
try to see if you can minimize it so that someone else can
compile it.
A couple of points about your code unrelated to your error:
* `private static int btnNumber = 1;` -- `static` has no meaning
at module scope. You'll see it in C code, but in D `private`
provides the same functionality. You can delete `static` from
those module scope declarations.
* `with(this){` -- you absolutely do not need to do this. `this`
is never required as a prefix on any member unless, e.g., a
member variable and another more locally scoped variable have the
same name, like `this.x = x` in a setter function to distinguish
the member variable from the function parameter. You're already
using the convention of naming your member variables with a `m`
prefix, so you won't run into that issue. `this.mFoo` is exactly
the same as `mFoo`, and with(this) is pointless. I mean, if you
want to use `this.mFoo` as a stylistic choice, that's your call
(though the `m` makes it redundant really), but even then using
`with(this)` serves no purpose.