[cfe-commits] r151170 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/expr/expr.prim/expr.prim.lambda/blocks.mm

Douglas Gregor dgregor at apple.com
Wed Mar 7 18:39:39 PST 2012

On Mar 7, 2012, at 6:33 PM, John McCall wrote:

> On Feb 22, 2012, at 9:32 AM, Douglas Gregor wrote:
>> Author: dgregor
>> Date: Wed Feb 22 11:32:19 2012
>> New Revision: 151170
>> URL: http://llvm.org/viewvc/llvm-project?rev=151170&view=rev
>> Log:
>> Teach overload resolution to prefer user-defined conversion via a
>> lambda closure type's function pointer conversion over user-defined
>> conversion via a lambda closure type's block pointer conversion,
>> always. This is a preference for more-standard code (since blocks
>> are an extension)  and a nod to efficiency, since function pointers
>> don't require any memory management. Fixes PR12063.
> Why does this have anything to do with Objective-C?
> Blocks are a C extension.

The memory-management model for the conversion to block pointer is retain+autorelease. Since we don't have an 'autorelease' equivalent in C-with-blocks, we opted to omit the block pointer conversion rather than invent another memory-management scheme.

Yes, we could probably come up with another solution, but IMO the user base for C++11-with-blocks-and-lambdas that isn't Objective-C++11 is too small to bother inventing something now.

	- Doug

More information about the cfe-commits mailing list