1*c87b03e5Sespie/* Contributed by Nicola Pero - Fri Oct 26 22:39:32 BST 2001 */ 2*c87b03e5Sespie#include <objc/objc.h> 3*c87b03e5Sespie 4*c87b03e5Sespie/* Test calling a class method when there is an instance method 5*c87b03e5Sespie with conflicting types */ 6*c87b03e5Sespie 7*c87b03e5Sespie/* This class should be unused but on broken compilers its instance 8*c87b03e5Sespie method might get picked up and used instead of the class method of 9*c87b03e5Sespie another class ! */ 10*c87b03e5Sespiestruct d 11*c87b03e5Sespie{ 12*c87b03e5Sespie int a; 13*c87b03e5Sespie}; 14*c87b03e5Sespie 15*c87b03e5Sespie@interface UnusedClass 16*c87b03e5Sespie{ 17*c87b03e5Sespie Class isa; 18*c87b03e5Sespie} 19*c87b03e5Sespie- (struct d) method; 20*c87b03e5Sespie@end 21*c87b03e5Sespie 22*c87b03e5Sespie@implementation UnusedClass 23*c87b03e5Sespie- (struct d) method 24*c87b03e5Sespie{ 25*c87b03e5Sespie struct d u; 26*c87b03e5Sespie u.a = 0; 27*c87b03e5Sespie 28*c87b03e5Sespie return u; 29*c87b03e5Sespie} 30*c87b03e5Sespie@end 31*c87b03e5Sespie 32*c87b03e5Sespie/* The real class */ 33*c87b03e5Sespie@interface TestClass 34*c87b03e5Sespie{ 35*c87b03e5Sespie Class isa; 36*c87b03e5Sespie} 37*c87b03e5Sespie+ (void) test; 38*c87b03e5Sespie+ (int) method; 39*c87b03e5Sespie@end 40*c87b03e5Sespie 41*c87b03e5Sespie@implementation TestClass 42*c87b03e5Sespie+ (void) test 43*c87b03e5Sespie{ 44*c87b03e5Sespie if ([self method] != 4) 45*c87b03e5Sespie { 46*c87b03e5Sespie abort (); 47*c87b03e5Sespie } 48*c87b03e5Sespie} 49*c87b03e5Sespie 50*c87b03e5Sespie+ (int) method 51*c87b03e5Sespie{ 52*c87b03e5Sespie return 4; 53*c87b03e5Sespie} 54*c87b03e5Sespie@end 55*c87b03e5Sespie 56*c87b03e5Sespie 57*c87b03e5Sespieint main (void) 58*c87b03e5Sespie{ 59*c87b03e5Sespie [TestClass test]; 60*c87b03e5Sespie 61*c87b03e5Sespie return 0; 62*c87b03e5Sespie} 63