Re: Synthesized ivar for std::tr1::shared_ptr<MyClass>?
Re: Synthesized ivar for std::tr1::shared_ptr<MyClass>?
- Subject: Re: Synthesized ivar for std::tr1::shared_ptr<MyClass>?
- From: Barry Wark <email@hidden>
- Date: Fri, 7 May 2010 11:47:46 -0700
On Thu, May 6, 2010 at 4:38 PM, Kyle Sluder <email@hidden> wrote:
> On Thu, May 6, 2010 at 4:18 PM, Barry Wark <email@hidden> wrote:
>> Thank you all for the suggestions. Using manual dynamic memory
>> allocation somewhat defeats the purpose of using smart pointers, but
>> it looks like that's the only option for now. For reference, I've
>> filed this as rdar://7953539, but would be happy to be shown the error
>> of my ways.
>
> It looks like there's just bad news all around with incomplete types
> and synthesized instance variables. I found clang crashes when told to
> synthesize an instance variable of incomplete type. I wouldn't be
> surprised if the interactions between ivar synthesis and the type
> system were not completely nailed down.
>
> For reference, the clang bug is http://llvm.org/bugs/show_bug.cgi?id=7064
Kyle,
Your comment brings things into better focus; it appears that template
instantiation is happening after the compiler attempts to synthesize
the ivar and accessor methods. Again, my C++-foo is weak but I recall
that template instantiation happens as a separate compilation step,
no? Too bad; it's a shame to have to resort to allocating a shared_ptr
on the heap just to play nicely with modern C++ code that's using RAII
(including smart pointers) to manage memory.
-Barry
>
> --Kyle Sluder
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden