[Issue 5256] New: null Rebindable testing not supported

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 21 18:57:08 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5256

           Summary: null Rebindable testing not supported
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-11-21 18:55:50 PST ---
This D2 program shows that you can't test if a class reference wrapped with
Rebindable is null:


import std.typecons;
const class Foo {}
void main() {
    auto a = Rebindable!Foo(new Foo);
    a = new Foo;
    assert(a !is null); // err
}


DMD 2.050 generates:
test.d(6): Error: incompatible types for ((a) !is (null)):
'Rebindable!(const(Foo))' and 'void*'


Is this the currently correct way to do it? (It works):

assert(a.get() !is null); // OK

I have seen the get() method is not documented on the site, so is that a
temporary limitation caused by the unfinished "alis this" implementation?

(Issue tagged with "Component: DMD" because I think it's a limit of "alias
this").

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list