llvm-project
37 строк · 1.1 Кб
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3struct __objcFastEnumerationState;
4typedef struct objc_class *Class;
5typedef struct objc_object {
6Class isa;
7} *id;
8
9
10@interface MyList
11@end
12
13@implementation MyList
14- (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount
15{
16return 0;
17}
18@end
19
20@interface MyList (BasicTest)
21- (void)compilerTestAgainst;
22@end
23
24@implementation MyList (BasicTest)
25- (void)compilerTestAgainst {
26
27int i=0;
28for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \
29expected-error {{the type 'int *' is not a pointer to a fast-enumerable object}}
30++i;
31for (i in elem) // expected-error {{use of undeclared identifier 'elem'}} \
32expected-error {{selector element type 'int' is not a valid object}}
33++i;
34for (id se in i) // expected-error {{the type 'int' is not a pointer to a fast-enumerable object}}
35++i;
36}
37@end
38
39