diff options
Diffstat (limited to 'test/SemaObjCXX/foreach.mm')
-rw-r--r-- | test/SemaObjCXX/foreach.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/SemaObjCXX/foreach.mm b/test/SemaObjCXX/foreach.mm index 3c4b908eab..d1302c19a5 100644 --- a/test/SemaObjCXX/foreach.mm +++ b/test/SemaObjCXX/foreach.mm @@ -12,8 +12,18 @@ void f(NSArray *a) { // expected-warning {{expression result unused}} for (id thisKey : keys); + + for (auto thisKey : keys) { } // expected-warning{{'auto' deduced as 'id' in declaration of 'thisKey'}} +} + +template<typename Collection> +void ft(Collection col) { + for (id x : col) { } + for (auto x : col) { } } +template void ft(NSArray *); + /* // rdar://9072298 */ @protocol NSObject @end @@ -59,3 +69,9 @@ void test2(NSObject<NSFastEnumeration> *collection) { // expected-warning {{property access result unused - getters should not be used for side effects}} } } + +void testErrors(NSArray *array) { + typedef int fn(int); + + for (fn x in array) { } // expected-error{{non-variable declaration in 'for' loop}} +} |