[Issue 13710] Invariants not enforced on methods from alias this
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Nov 11 05:10:46 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13710
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |schveiguy at yahoo.com
Resolution|--- |INVALID
--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
I think from angel's comment that discussion, this bug is invalid. There is no
method to call, so it cannot hook the invariant, x -= 100 translates directly
to machine instructions.
What I would suggest is instead of using alias this, use opDispatch and
opBinary to implement inlined functions that forward to the member. Then your
invariant will be called. Instead of using alias this for inheritance, use
composition.
--
More information about the Digitalmars-d-bugs
mailing list