[Issue 14911] New: Compiler found indexing in code "new MyStruct[2].ptr"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 12 09:25:27 PDT 2015


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

          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 at puremagic.com
          Reporter: kdmult at 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;   
}

--


More information about the Digitalmars-d-bugs mailing list