summaryrefslogtreecommitdiffstats
path: root/test/SemaObjCXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-06-23 19:02:52 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-06-23 19:02:52 +0000
commita64a49776e41ee8edeb24caf928e489f7b1df0e5 (patch)
tree6b775601632fc52f916af0ee057604c7d1e0fede /test/SemaObjCXX
parentc4e95c76197d386452a9b4524a4a5429b32bce72 (diff)
Re-commit r273548, reverted in r273589, with a fix to not produce
-Wfor-loop-analysis warnings for a for-loop with a condition variable. In such a case, the loop condition variable is modified on each iteration of the loop by definition. Original commit message: Rearrange condition handling so that semantic checks on a condition variable are performed before the other substatements of the construct are parsed, rather than deferring them until the end. This allows better error recovery from semantic errors in the condition, improves diagnostic order, and is a prerequisite for C++17 constexpr if. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273600 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r--test/SemaObjCXX/foreach.mm9
1 files changed, 3 insertions, 6 deletions
diff --git a/test/SemaObjCXX/foreach.mm b/test/SemaObjCXX/foreach.mm
index d1302c19a5..99f5d0ce55 100644
--- a/test/SemaObjCXX/foreach.mm
+++ b/test/SemaObjCXX/foreach.mm
@@ -6,10 +6,8 @@
void f(NSArray *a) {
id keys;
for (int i : a); // expected-error{{selector element type 'int' is not a valid object}}
- for ((id)2 : a); // expected-error {{for range declaration must declare a variable}} \
- // expected-warning {{expression result unused}}
- for (2 : a); // expected-error {{for range declaration must declare a variable}} \
- // expected-warning {{expression result unused}}
+ for ((id)2 : a); // expected-error {{for range declaration must declare a variable}}
+ for (2 : a); // expected-error {{for range declaration must declare a variable}}
for (id thisKey : keys);
@@ -65,8 +63,7 @@ int main ()
@end
void test2(NSObject<NSFastEnumeration> *collection) {
Test2 *obj;
- for (obj.prop : collection) { // expected-error {{for range declaration must declare a variable}} \
- // expected-warning {{property access result unused - getters should not be used for side effects}}
+ for (obj.prop : collection) { // expected-error {{for range declaration must declare a variable}}
}
}