[Issue 22536] New: CTFE: Missing destruction of array literal argument for scope slice parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 22 15:39:32 UTC 2021


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

          Issue ID: 22536
           Summary: CTFE: Missing destruction of array literal argument
                    for scope slice parameter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kinke at gmx.net

void foo(T)(scope T[]) {}

int bar()
{
    int numDtor;

    struct S
    {
        int x;
        ~this() { ++numDtor; }
    }

    foo([S(1), S(2)]);
    return numDtor;
}    

void main()
{
    assert(bar() == 2);
}

static assert(bar() == 2); // fails, returns 0

--


More information about the Digitalmars-d-bugs mailing list