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

John McCall rjmccall at apple.com
Sat Mar 10 11:48:49 PST 2012


On Mar 9, 2012, at 3:30 PM, Douglas Gregor wrote:
> On Mar 7, 2012, at 6:55 PM, John McCall wrote:
>> On Mar 7, 2012, at 6:39 PM, Douglas Gregor wrote:
>>> 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.
>> 
>> Mmm, alright.  Is this documented somewhere?
> 
> r152446

Thanks!  I guess by calling this an Objective-C extension, we're implicitly documenting that it's not available in C++-with-blocks.  I think it's worth stating that explicitly, though.

John.



More information about the cfe-commits mailing list