[Issue 14737] [REG2.058] A concatenation of array literal and static array should make dynamic array

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jun 25 23:03:51 PDT 2015


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

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86_64                      |All
            Summary|[2.068 beta] Array          |[REG2.058] A concatenation
                   |concatenation fails in enum |of array literal and static
                   |declaration                 |array should make dynamic
                   |                            |array
                 OS|Linux                       |All

--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to briancschott from comment #0)
> With 2.068.0-b1, it fails with this error:
> test.d(12): Error: cannot cast expression ["a", "b", "c"] of type string[]
> to string[2]
> test.d(16): Error: cannot cast expression ["a", "b", "c"] of type string[]
> to string[2]

A concatenation T[] ~ T[n] should be typed as T[], so the both cases should
succeed to compile.

With the reduced test case:

void main()
{
    string[2] a2 = ["d", "e"];
    auto b2 = ["a", "b", "c"] ~ a2;
    assert(b2 == ["a", "b", "c", "d", "e"]);
}

It had worked until 2.057, but since 2.058 e2ir error has occurred.

The rejects-valid regression was introduced in:
https://github.com/D-Programming-Language/dmd/pull/618

--


More information about the Digitalmars-d-bugs mailing list