D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3318 - [PATCH]Rebindable.get is not accessible
Summary: [PATCH]Rebindable.get is not accessible
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
: 4978 (view as issue list)
Depends on:
Blocks:
 
Reported: 2009-09-14 23:18 UTC by Sönke Ludwig
Modified: 2015-06-09 01:26 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sönke Ludwig 2009-09-14 23:18:24 UTC
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
Comment 1 Simen Kjaeraas 2010-08-31 07:55:51 UTC
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;
            }
Comment 2 Andrei Alexandrescu 2010-10-02 19:21:53 UTC
http://www.dsource.org/projects/phobos/changeset/2080
Comment 3 Jonathan M Davis 2010-10-02 19:51:38 UTC
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.
Comment 4 Andrei Alexandrescu 2010-10-03 12:09:35 UTC
The alias makes Rebindable!T a near-subtype of T.
Comment 5 Steven Schveighoffer 2010-10-04 06:15:59 UTC
*** Issue 4978 has been marked as a duplicate of this issue. ***