Comment #0 by bearophile_hugs — 2013-12-12T10:09:07Z
Title:
Component: dmd
Severity:
Code number:
Keywords:
Outcome:
Is done: no
See also:
I am not sure this is a but, it seems like one:
void main() {
bool test;
string s1 = test ? "" : null; // OK
dstring s2 = test ? ""d : null; // OK
dstring s3 = test ? "" : ""; // OK
dstring s4 = test ? "" : null; // error
dstring[] a = test ? [""d] : null; // OK
dstring[] b = test ? [""] : null; // error
}
dmd 2.065alpha gives:
temp.d(6): Error: cannot implicitly convert expression (test ? "" : null) of type string to immutable(dchar)[]
temp.d(8): Error: cannot implicitly convert expression (test ? [""] : null) of type string[] to immutable(dchar)[][]
Comment #1 by yebblies — 2013-12-12T23:00:06Z
First one is similar to issue 9968.
Comment #2 by robert.schadek — 2024-12-13T18:15:08Z