[PATCH] Don't mistakenly capture byref in block nested in lambda

Ben Langmuir blangmuir at apple.com
Tue Jan 27 15:06:36 PST 2015


Hi Richard,

Could you take a look at this patch?  I haven’t messed with capturing in a long time and I don’t want to break it ;-)

    Don't mistakenly capture byref in block nested in lambda
    
    Even if an enclosing lambda captures a variable by reference, we capture
    it by *copy* in a block unless the variable itself was declared with a
    reference type. Codegen was already correct, but we were not diagnosing
    attempts to modify the variable in Sema.
    
    This also fixes a crash on invalid when trying to modify a variable with
    non-trivial copy constructor and assignment operator in such a
    situation.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: block-in-lambda.patch
Type: application/octet-stream
Size: 5304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150127/b31feda2/attachment.obj>


More information about the cfe-commits mailing list