[Issue 5730] Error: variable has scoped destruction, cannot build closure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 12 01:56:30 PST 2011


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



--- Comment #2 from Max Samukha <samukha at voliacable.com> 2011-03-12 01:53:09 PST ---
No, no. The bug is not about the impossibility to build a closure. It is about
__traits(compiles) not handling the compilation error properly. It should
suppress the error and evaluate to false.  

Another example:

struct S
{
    ~this()
    {
    }
}

void main()
{
    S s;    
    static if (__traits(compiles, { auto s1 = s; }))
        pragma(msg, "Can build closure");
    else
        pragma(msg, "Cannot build closure");
}
----
The compiler outputs:
Can build closure
Error: variable test.main.s has scoped destruction, cannot build closure


Instead, the above should compile successfully, printing "Cannot build closure"
at compile time.

-- 
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