1 // RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
8 void throw_test(T value) {
9 @throw value; // expected-error{{@throw requires an Objective-C object type ('int' invalid)}}
12 template void throw_test(NSException *);
13 template void throw_test(int); // expected-note{{in instantiation of}}
17 void synchronized_test(T value) {
18 @synchronized (value) { // expected-error{{@synchronized requires an Objective-C object type ('int' invalid)}}
23 template void synchronized_test(NSException *);
24 template void synchronized_test(int); // expected-note{{in instantiation of}}
28 - (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount;
36 template<typename T> void eat(T);
38 template<typename E, typename T>
39 void fast_enumeration_test(T collection) {
40 for (E element in collection) { // expected-error{{selector element type 'int' is not a valid object}} \
41 // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
46 for (element in collection) // expected-error{{selector element type 'int' is not a valid object}} \
47 // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
50 for (NSString *str in collection) // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
54 for (str in collection) // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
58 template void fast_enumeration_test<NSString *>(NSArray*);
59 template void fast_enumeration_test<int>(NSArray*); // expected-note{{in instantiation of}}
60 template void fast_enumeration_test<NSString *>(vector); // expected-note{{in instantiation of}}
62 // @try/@catch/@finally
64 template<typename T, typename U>
65 void try_catch_finally_test(U value) {
67 value = 1; // expected-error{{incompatible integer to pointer conversion assigning to 'int *' from 'int'}}
69 @catch (T obj) { // expected-error{{@catch parameter is not a pointer to an interface type}}
76 template void try_catch_finally_test<NSString *>(int);
77 template void try_catch_finally_test<NSString *>(int*); // expected-note{{in instantiation of}}
78 template void try_catch_finally_test<NSString>(int); // expected-note{{in instantiation of function template specialization 'try_catch_finally_test<NSString, int>' requested here}}