[Issue 14682] [REG2.037] Incorrect interpretation of ~ []

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 10 23:34:24 PDT 2015


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

--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> ---
> For some reason, DMD interprets `~[]` as `~[""]`.

Because:
    auto foo = ["foo"] ~ [];

is equivalent to:
    auto foo = ["foo"] ~ "";

At a concatenation expression, arr ~ elem is preferred than arr ~ arr2 when
elem is implicitly convertible to typeof(arr[i]). In the code, the rhs `[]` is
implicitly convertible to typeof("foo") == string.

--


More information about the Digitalmars-d-bugs mailing list