[Issue 510] New: Nonworking implicit conversions between arrays and pointers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 15 03:22:37 PST 2006


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

           Summary: Nonworking implicit conversions between arrays and
                    pointers
           Product: D
           Version: 0.174
          Platform: PC
               URL: http://www.digitalmars.com/d/arrays.html
        OS/Version: Windows
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P4
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: deewiant at gmail.com


The comments should explain it:

class U {}
class T : U {}

void main() {
        T*   ptr;
        T[2] sar;
        T[]  dar;

        // all of the following should work according to the "Implicit
Conversions" section of the spec

        tPtr(ptr); tPtr(sar); tPtr(dar);
        tDar(sar);
        uPtr(ptr); uPtr(sar); uPtr(dar); // none of these work
        uSar(sar);                       // doesn't work
        uDar(sar); uDar(dar);            // the first of these doesn't work
        vPtr(ptr); vPtr(sar); vPtr(dar);
        vDar(sar); vDar(dar);            // the latter of these two works, but
isn't mentioned in the spec
}

void tPtr(T*t){}
void tDar(T[]t){}
void uPtr(U*u){}
void uSar(U[2]u){}
void uDar(U[]u){}
void vPtr(void*v){}
void vDar(void[]v){}


-- 




More information about the Digitalmars-d-bugs mailing list