www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21608] New: [betterC] static slices are allowed and have the

https://issues.dlang.org/show_bug.cgi?id=21608

          Issue ID: 21608
           Summary: [betterC] static slices are allowed and have the wrong
                    size
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: lucien.perregaux gmail.com

Pretty much the title.

Slices uses TypeInfo, which should be disallowed in betterC mode.

---
import core.stdc.stdio;

extern(C) void main()
{
    static int[] a = [ 1, 2, 3, 4, 5, 6 ];  // Shouldn't be allowed
    printf("%lli", a.sizeof);   // prints 16 instead of 24
}
---

--
Feb 03