[Issue 11382] New: Bad closure variable with scoped destruction

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 29 21:32:42 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11382

           Summary: Bad closure variable with scoped destruction
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-10-29 21:32:40 PDT ---
In the following code, compiler should reject the function 'foo' by
"has scoped destruction, cannot build closure" error.

struct S
{
    ~this() {}
}

auto foo()
{
    S s = S();
    return { s = S(); };
}

void main() {}

It is checked in toir.c FuncDeclaration::buildClosure(), however currently it
doesn't work for the variables which are explicitly declared on statement.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list