Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: ARC and Objective-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC and Objective-C++



On Feb 13, 2012, at 6:34 PM, Chris Suter wrote:
> On Tue, Feb 14, 2012 at 12:39 PM, John McCall <email@hidden> wrote:
>
>> Again, there's a bad diagnostic here, but the same problem occurs in
>> non-ARC.  Template argument deduction infers T=NSString*, and then you can't
>> actually initialize an NSString*& with an NSString* r-value.
>
> OK, but there is an ARC issue. If you change the template to:
>
> template<typename T>
> static void boom(T const & arg) {
>    NSLog(@"boom! yes!");
> }
>
> It works non-ARC (as it should), but not under ARC (Apple clang
> version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)).
>
> Is that a bug?

That one definitely looks like a bug. :)

As a workaround, using T as the argument type should work just fine
if you're only trying to be polymorphic over ObjC object types.

John.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >ARC and Objective-C++ (From: Dmitriy Kalinin <email@hidden>)
 >Re: ARC and Objective-C++ (From: John McCall <email@hidden>)
 >Re: ARC and Objective-C++ (From: Chris Suter <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.