I am currently trying to compile OCMock with GCC4.2 (original: 4.0) and start getting the following warning:
warning: passing argument 1 of
‘partialMockForObject:’ from distinct
Objective-C type
the calling method is:
- (void)forwardInvocationForRealObject:(NSInvocation *)anInvocation
{
// in here "self" is a reference to the real object, not the mock
OCPartialMockObject *mock = [OCPartialMockObject partialMockForObject:(id)self];
// ...
}
and the called method is:
+ (id)partialMockForObject:(NSObject *)anObject;
prefixing the argument with a cast to id fixes the problem. I thought all objects were subclass of NSObject and though the cast would be made implicit (super class substitution: a super class can always be replaced by any child class of it)
All objects are not necessarily descended from NSObject. Most Cocoa classes are (NSProxy is the only exception that occurs off the top of my head), but if you don’t declare a class as being descended from NSObject, it won’t be. Could it be that you forgot that in the declaration of wherever this occurs?