2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
2009-03-04 23:11:40 +08:00
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2009-04-07 06:07:54 +08:00
|
|
|
typedef struct objc_class *Class;
|
|
|
|
typedef struct objc_object {
|
|
|
|
Class isa;
|
|
|
|
} *id;
|
2009-03-04 23:11:40 +08:00
|
|
|
id objc_getClass(const char *s);
|
|
|
|
|
|
|
|
@interface Object
|
|
|
|
@end
|
|
|
|
|
|
|
|
@protocol Func
|
|
|
|
+ (int) class_func0;
|
|
|
|
- (int) instance_func0;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Derived: Object
|
|
|
|
+ (int) class_func1;
|
|
|
|
+ (int) class_func2;
|
|
|
|
+ (int) class_func3;
|
|
|
|
+ (int) class_func4;
|
|
|
|
+ (int) class_func5;
|
|
|
|
+ (int) class_func6;
|
|
|
|
+ (int) class_func7;
|
|
|
|
- (int) instance_func1;
|
|
|
|
- (int) instance_func2;
|
|
|
|
- (int) instance_func3;
|
|
|
|
- (int) instance_func4;
|
|
|
|
- (int) instance_func5;
|
|
|
|
- (int) instance_func6;
|
|
|
|
- (int) instance_func7;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation Derived
|
|
|
|
+ (int) class_func1
|
|
|
|
{
|
|
|
|
int i = (size_t)[self class_func0]; // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}}
|
|
|
|
return i + (size_t)[super class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
|
|
|
|
}
|
|
|
|
+ (int) class_func2
|
|
|
|
{
|
|
|
|
int i = [(id <Func>)self class_func0]; // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion initializing 'id', expected 'int'}}
|
2009-04-07 06:07:54 +08:00
|
|
|
i += [(id <Func>)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}} // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion assigning 'id', expected 'int'}}
|
2009-03-04 23:11:40 +08:00
|
|
|
i += [(Class <Func>)self class_func0]; // expected-error {{protocol qualified 'Class' is unsupported}}
|
2009-04-07 06:07:54 +08:00
|
|
|
return i + [(Class <Func>)super class_func0]; // expected-error {{protocol qualified 'Class' is unsupported}} // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
|
2009-03-04 23:11:40 +08:00
|
|
|
}
|
|
|
|
+ (int) class_func3
|
|
|
|
{
|
2009-04-07 06:07:54 +08:00
|
|
|
return [(Object <Func> *)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}} // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion returning 'id', expected 'int'}}
|
2009-03-04 23:11:40 +08:00
|
|
|
}
|
|
|
|
+ (int) class_func4
|
|
|
|
{
|
2009-04-07 06:07:54 +08:00
|
|
|
return [(Derived <Func> *)super class_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}} // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}} // expected-warning {{incompatible pointer to integer conversion returning 'id', expected 'int'}}
|
2009-03-04 23:11:40 +08:00
|
|
|
}
|
|
|
|
+ (int) class_func5
|
|
|
|
{
|
|
|
|
int i = (size_t)[Derived class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
|
|
|
|
return i + (size_t)[Object class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
|
|
|
|
}
|
|
|
|
+ (int) class_func6
|
|
|
|
{
|
|
|
|
return (size_t)[objc_getClass("Object") class_func1]; // GCC warns about this
|
|
|
|
}
|
|
|
|
+ (int) class_func7
|
|
|
|
{
|
|
|
|
return [objc_getClass("Derived") class_func1];
|
|
|
|
}
|
|
|
|
- (int) instance_func1
|
|
|
|
{
|
|
|
|
int i = (size_t)[self instance_func0]; // expected-warning {{method '-instance_func0' not found (return type defaults to 'id'))}}
|
|
|
|
return i + (size_t)[super instance_func0]; // expected-warning {{method '-instance_func0' not found (return type defaults to 'id')}}
|
|
|
|
}
|
|
|
|
- (int) instance_func2
|
|
|
|
{
|
2009-04-07 06:07:54 +08:00
|
|
|
return [(id <Func>)super instance_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
|
2009-03-04 23:11:40 +08:00
|
|
|
}
|
|
|
|
- (int) instance_func3
|
|
|
|
{
|
2009-04-07 06:07:54 +08:00
|
|
|
return [(Object <Func> *)super instance_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
|
2009-03-04 23:11:40 +08:00
|
|
|
}
|
|
|
|
- (int) instance_func4
|
|
|
|
{
|
2009-04-07 06:07:54 +08:00
|
|
|
return [(Derived <Func> *)super instance_func0]; // expected-warning {{casting 'super' is deprecated (it isn't an expression)}}
|
2009-03-04 23:11:40 +08:00
|
|
|
}
|
|
|
|
- (int) instance_func5
|
|
|
|
{
|
2009-03-05 01:50:39 +08:00
|
|
|
int i = (size_t)[Derived instance_func1]; // expected-warning {{method '+instance_func1' not found (return type defaults to 'id')}}
|
2009-03-04 23:11:40 +08:00
|
|
|
return i + (size_t)[Object instance_func1]; // expected-warning {{method '+instance_func1' not found (return type defaults to 'id')}}
|
|
|
|
}
|
|
|
|
- (int) instance_func6
|
|
|
|
{
|
|
|
|
return (size_t)[objc_getClass("Object") class_func1];
|
|
|
|
}
|
|
|
|
- (int) instance_func7
|
|
|
|
{
|
|
|
|
return [objc_getClass("Derived") class_func1];
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|