diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-21 20:01:35 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-21 20:01:35 +0000 |
commit | e38fa1866e684b99c6c6e359449af9e0b6e83164 (patch) | |
tree | deb072152dce1b63648b61578dc6ca994e460666 /lib/Parse/ParseStmt.cpp | |
parent | f57c413e444b441fa75ae8911d183c19b53bdd56 (diff) |
Don't assume that a valid expression for the first part of a for-statement
is non-null when diagnosing a broken attempt to write a for-range-statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151081 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index c256f7842d..54f1b51f7e 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1396,8 +1396,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, return StmtError(); } Collection = ParseExpression(); - } else if (getLang().CPlusPlus0x && Tok.is(tok::colon) && - !FirstPart.isInvalid()) { + } else if (getLang().CPlusPlus0x && Tok.is(tok::colon) && FirstPart.get()) { // User tried to write the reasonable, but ill-formed, for-range-statement // for (expr : expr) { ... } Diag(Tok, diag::err_for_range_expected_decl) |