gnustep / libobjc2

Objective-C runtime library intended for use with Clang.
http://www.gnustep.org/
MIT License
441 stars 119 forks source link

Retrieve class of instance in objc_alloc_init #315

Closed hmelder closed 21 hours ago

hmelder commented 1 day ago

If +alloc was overwritten, it is not guaranteed that it returns an instance of cls. For example, a class cluster like NSString might return an instance of a subclass instead. Retrieve the class of the instance returned by objc_alloc instead.