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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 12 00:53:10 PST 2011


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|                            |INVALID


--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> 2011-03-12 00:50:04 PST ---
Right. {auto s1=s;} is a delegate literal. Delegate literals need to be able to
survive the end of the function they are defined inside. Since s is destroyed
upon the exit from main(), then this will not work, hence the error message.

This is expected behavior, not a bug.

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