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

--- Comment #0 from 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;
   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:
------- You are receiving this mail because: -------

Reply via email to