xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/protocol-qualified-class-unsupported.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc#include <stddef.h>
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuctypedef struct objc_class *Class;
7*f4a2713aSLionel Sambuctypedef struct objc_object {
8*f4a2713aSLionel Sambuc    Class isa;
9*f4a2713aSLionel Sambuc} *id;
10*f4a2713aSLionel Sambucid objc_getClass(const char *s);
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc@interface Object
13*f4a2713aSLionel Sambuc+ self;
14*f4a2713aSLionel Sambuc@end
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc@protocol Func
17*f4a2713aSLionel Sambuc+ (void) class_func0;
18*f4a2713aSLionel Sambuc- (void) instance_func0;
19*f4a2713aSLionel Sambuc@end
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc@interface Derived: Object <Func>
22*f4a2713aSLionel Sambuc@end
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@interface Derived2: Object <Func>
25*f4a2713aSLionel Sambuc@end
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambucstatic void doSomething(Class <Func> unsupportedObjectType) {
28*f4a2713aSLionel Sambuc  [unsupportedObjectType class_func0];
29*f4a2713aSLionel Sambuc}
30*f4a2713aSLionel Sambuc
31*f4a2713aSLionel Sambucstatic void doSomethingElse(id <Func> pleaseConvertToThisType) {
32*f4a2713aSLionel Sambuc  [pleaseConvertToThisType class_func0];
33*f4a2713aSLionel Sambuc}
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambucint main(int argv, char *argc[]) {
36*f4a2713aSLionel Sambuc  doSomething([Derived self]);
37*f4a2713aSLionel Sambuc  doSomething([Derived2 self]);
38*f4a2713aSLionel Sambuc  doSomethingElse([Derived self]);
39*f4a2713aSLionel Sambuc  doSomethingElse([Derived2 self]);
40*f4a2713aSLionel Sambuc}
41*f4a2713aSLionel Sambuc
42