www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18260] New: ICE on template this parameter and alias this

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

          Issue ID: 18260
           Summary: ICE on template this parameter and alias this
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

The following code causes DMD to hang:

struct R {
    int[] arr;

    alias get this;
    R get(this This)() {
        return R.init;
    }
}
unittest {
    const(R) b = const(R).init;
}

As far as my testing shows, every line is necessary, and arr must be a dynamic
array. Changing get() to assert(false) instead of return, removes the bug.

--
Jan 18 2018