[Issue 21608] New: [betterC] static slices are allowed and have the wrong size
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Feb  3 21:04:31 UTC 2021
    
    
  
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 at puremagic.com
          Reporter: lucien.perregaux at 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
}
---
--
    
    
More information about the Digitalmars-d-bugs
mailing list