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

           Summary: Deferencing a dynamic array as pointer
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-03-20 05:57:22 PDT ---
This D2 code is currrently allowed, but I think it has to become a syntax
error, dynamic arrays are not pointers:

void main() {
   int[] a1 = [5, 4, 3];
   assert(*a1 == 5);
   alias typeof(a1) T1;
   assert(is(typeof(*T1)));
   int* p1 = cast(int*)a1;
   assert(p1 == a1.ptr);
}

----------------

Similar code can be written for a fixed-size array like:
int[3] a2 = [5, 4, 3];

For fixed-size arrays such conversions to pointers can be more acceptable.

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

Reply via email to