[Issue 1038] New: explicit class cast breakage in 1.007

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 8 02:55:04 PST 2007


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

           Summary: explicit class cast breakage in 1.007
           Product: D
           Version: 1.007
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: default_357-line at yahoo.de


Consider the following code:
import std.stdio;

class A { }
class B : A { }

void main() {
  A test=new B;
  writefln("Test is ", test.toString);
  A test_2=cast(A)(new B);
  writefln("Test 2 is ", test_2.toString);
}

What we would expect to see is "test7.B" twice.
However, what we see is "test7.B" and "test7.A", which of course completely
breaks polymorphism.

The error doesn't appear on 1.005, so it was introduced either in '006 or '007.
Greetings --downs


-- 



More information about the Digitalmars-d-bugs mailing list