www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19691] New: ICE on null default value for struct parameter in

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

          Issue ID: 19691
           Summary: ICE on null default value for struct parameter in
                    constructor
           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

This code:

struct S1 {
    this(T...)(T) {
        S2("");
    }
}

struct S2 {
    this(string) {}
    this(S1 s = null) {}
}

Crashes the compiler (2.084.1). I've not been able to reduce it to a simple
overload problem. That is, this does not exhibit the same issue:

struct S1 {
    this(T...)(T) {
        fun("");
    }
}

void fun(S1 s = null) {}
void fun(string s) {}

--
Feb 21 2019