OSArray*a=(OSArray*)obj;// expected-warning{{C-style cast of an OSObject is prone to type confusion attacks; use 'OSRequiredCast' if the object is definitely of type 'OSArray', or 'OSDynamicCast' followed by a null check if unsure}}
OSArray*a=(OSArray*)OSMetaClass::allocClassWithName("OSArray");// no warning
returna->getCount();
}
unsignedwarn_alloc_class_with_name(){
OSArray*a=(OSArray*)OSMetaClass::allocClassWithName("OSObject");// expected-warning{{C-style cast of an OSObject is prone to type confusion attacks; use 'OSRequiredCast' if the object is definitely of type 'OSArray', or 'OSDynamicCast' followed by a null check if unsure}}