diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-06-23 19:02:52 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-06-23 19:02:52 +0000 |
commit | 03a4aa3d0069be59b72e0e3528eca356b09d312e (patch) | |
tree | 69f664b5bf9bdf4cfe0cb6b55cd9415b94a9388b /clang/test/SemaCXX/for-range-examples.cpp | |
parent | 2cd2a18a9f14fbcb7364786d058caafdb359f523 (diff) | |
download | bcm5719-llvm-03a4aa3d0069be59b72e0e3528eca356b09d312e.tar.gz bcm5719-llvm-03a4aa3d0069be59b72e0e3528eca356b09d312e.zip |
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.
llvm-svn: 273600
Diffstat (limited to 'clang/test/SemaCXX/for-range-examples.cpp')
-rw-r--r-- | clang/test/SemaCXX/for-range-examples.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/for-range-examples.cpp b/clang/test/SemaCXX/for-range-examples.cpp index 83023e31101..08a9982c637 100644 --- a/clang/test/SemaCXX/for-range-examples.cpp +++ b/clang/test/SemaCXX/for-range-examples.cpp @@ -176,9 +176,9 @@ namespace test4 { // Make sure these don't crash. Better diagnostics would be nice. for (: {1, 2, 3}) {} // expected-error {{expected expression}} expected-error {{expected ';'}} - for (1 : {1, 2, 3}) {} // expected-error {{must declare a variable}} expected-warning {{result unused}} + for (1 : {1, 2, 3}) {} // expected-error {{must declare a variable}} for (+x : {1, 2, 3}) {} // expected-error {{undeclared identifier}} expected-error {{expected ';'}} - for (+y : {1, 2, 3}) {} // expected-error {{must declare a variable}} expected-warning {{result unused}} + for (+y : {1, 2, 3}) {} // expected-error {{must declare a variable}} } } |