Rebindable.get is an alias for Rebindable.original, which in turn is private: --- import std.typecons; class C {} void main(){ Rebindable!(const(C)) test; const(C) testCopy = test.get; } --- test.d(7): Error: struct std.typecons.Rebindable!(const(C)).Rebindable member original is not accessible test.d(7): Error: struct std.typecons.Rebindable!(const(C)).Rebindable member original is not accessible
This is the fix - replace this line(746 in 2.048) in std/typecons.d: alias original get; with this: @property ref T get( ) { return original; }
http://www.dsource.org/projects/phobos/changeset/2080
What's the point of alias get this; in the fix? I would have thought that that would conflict with the get property function. It would seem to make it so that get would either give you the type that Rebindable!() holds or Rebindable!() itself which would appear to effectively overload get on the return type.
The alias makes Rebindable!T a near-subtype of T.
*** Issue 4978 has been marked as a duplicate of this issue. ***