I tried below, but compiler does not understand it:
//Foo.mm
id anObjOfTypeFoo;
Foo* obj = (Foo*) anObjOfTypeFoo; //ERROR: must use __bridge
Foo* obj = (__bridge Foo*) anObjOfTypeFoo; //OKAY
Foo* obj = static_cast<__bridge Foo*> (anObjOfTypeFoo); //ERROR
Foo* obj = __bridge (static_cast<Foo*> (anObjOfTypeFoo)); //ERROR
Since Objective-C code is effectively compiled by a C++ compiler for a .mm compilation unit, it should really not have problems to bridge the casts of C++. Can someone shed light on this please?