[Issue 1747] interface inheritance + casting ==> wrong method invoked

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 4 00:18:19 PDT 2011


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


Brad Roberts <braddr at puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |braddr at puremagic.com
          Component|Phobos                      |DMD
            Version|0.24                        |D1 & D2
         AssignedTo|ibuclaw at ubuntu.com          |nobody at puremagic.com
            Product|DGCC aka GDC                |D
            Summary|math.hypot and conv.toReal  |interface inheritance +
                   |& toString unittests failed |casting ==> wrong method
                   |on FreeBSD8                 |invoked
           Severity|minor                       |normal


--- Comment #4 from Brad Roberts <braddr at puremagic.com> 2011-06-04 00:13:48 PDT ---
This is a general front end bug, not a gdc specific bug.  Recategorizing it.

Changing the attached code slightly shows that mA is what's being invoked
rather than the intended mB.

class ClassX : IntyD
{
    void mA() { g |= 1; }
    void mB() { g |= 2; }
    void mD() { g |= 4; }
}

void main()
{
    ClassX x = new ClassX;
    assert(g == 0);
    IntyB b = test(x);
    assert(g == 0);
    b.mB();

    printf("g = %d\n", g);
    assert(g == 2);
}

-- 
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