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

           Summary: const hole for implicit conversion to base class
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2012-03-03 16:17:19 PST ---
class Base
{
    int _val;
}

class Foo : Base
{
    Base base() const { return this; }
}

void main()
{
    const(Foo) foo = new const(Foo);
    static assert(!__traits(compiles, foo._val = 1));
    static assert(!__traits(compiles, foo.base()._val = 1));
    foo.base()._val = 1;
    assert(foo._val == 0);
}

Also broken for immutable and shared.
--------

This is probably implemented as 'return cast(Base)this;' and
needs to include the right modifiers.

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

Reply via email to