digitalmars.D.bugs - [Issue 5898] New: [const] std.typecons.Rebindable.get() should be const-correct
- d-bugmail puremagic.com (50/50) Apr 27 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5898
- d-bugmail puremagic.com (11/11) Oct 10 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5898
http://d.puremagic.com/issues/show_bug.cgi?id=5898 Summary: [const] std.typecons.Rebindable.get() should be const-correct Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: patch, rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: kennytm gmail.com --- Comment #0 from kennytm gmail.com 2011-04-27 07:50:31 PDT --- Currently std.typecons.Rebindable.get() is not a const function. This makes the a rebindable member not usable in a const function, e.g. ------------------------------------------ import std.typecons; class Y { string t; } class X { Rebindable!(const(Y)) y; override string toString() const { return y.t; // Error } } ------------------------------------------ x.d(8): Error: function std.typecons.Rebindable!(const(Y)).Rebindable.get () is not callable using argument types () ------------------------------------------ There should be a const get() method, e.g. diff --git a/std/typecons.d b/std/typecons.d index 7d130ca..bbf7615 100644 --- a/std/typecons.d +++ b/std/typecons.d -920,6 +920,9 template Rebindable(T) if (is(T == class) || is(T == interface) || isArray!(T)) property ref T get() { return original; } + property const(T) get() const { + return original; + } alias get this; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 27 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5898 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2011-10-10 19:40:10 PDT --- https://github.com/D-Programming-Language/phobos/commit/cf62cd2b3d2b0c4d92536cafbec70427f46a68d6 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 10 2011