Skip to content

returned array-of-array literals share address #1924

@John-Colvin

Description

@John-Colvin
auto make2d()
{
    return [[0.0]];
}

void main()
{
    auto a = make2d();
    auto b = make2d();
    assert (a.ptr !is b.ptr);
    assert (a[0].ptr !is b[0].ptr); // FAILS!!!
}

I'm 99% sure this bug wasn't present in 1.1.0-b2, but it's definitely there in b6. Seems likely to have been caused by https://github.com/ldc-developers/ldc/pull/1821/files

This is a pretty nasty bug that could cause all manner of pain. It currently breaks https://github.com/DlangScience/dstats tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions