www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14911] New: Compiler found indexing in code "new


          Issue ID: 14911
           Summary: Compiler found indexing in code "new MyStruct[2].ptr"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kdmult ya.ru

The following code does not compile with dmd v2.068.0.

void main()
    int* buf1 = new int[2].ptr;             // Ok

    struct MyStruct {}
    MyStruct* buf2 = (new MyStruct[2]).ptr; // Ok

    // Error: expected TypeTuple when indexing ('[2]'), got 'MyStruct'
    MyStruct* buf3 = new MyStruct[2].ptr;   

Aug 12 2015