__bridge and C++ references

I was working on the following snippet with ARC enabled. I expected the first function to complain about needing the __bridge keyword. It did not. I could get the __bridge keyword to be required as demonstrated in the second function. I suspect the rules are quite complete on the ARC checking. I thought I would bring this case to the attention of the list in case you wanted to tighten up those rules. cf_ptr is a subclass of std::unique_ptr<> that is tailored for CoreFoundation types. It seems that the ARC __bridge doesn’t get invoked there either. I expected casting this template to give me the __bridge error since it contains a data member of type NSString*.

typedef strip_pointer::type CFString;
#ifdef OBJC

inline void copy(const NSString& theValue, std::string& theTarget)
{
copy( (const CFString&)theValue, theTarget);
}

inline void copy(const NSString& theValue, ustring& theTarget)
{
copy( *(__bridge const CFStringRef) &theValue, theTarget);
}

inline void copy(const std::string& theValue, cf_ptr& theTargetSPtr )
{
copy(theValue, (cf_ptr&) theTargetSPtr);
}

inline void copy(const ustring& theValue, cf_ptr& theTargetSPtr )
{
copy(theValue, (cf_ptr&) theTargetSPtr);
}

#endif