aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-24 21:34:32 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-24 21:34:32 +0000
commit04895d301e1107a8f03673c43c939a115c3c1195 (patch)
tree76a14b98daffd344f499910f64ba7fb198f47412
parent5656e14d91405417182171a705ed3e3d2d6d7aa3 (diff)
"Do" loops cannot have condition variables, so don't parse them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89801 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseStmt.cpp7
-rw-r--r--test/SemaTemplate/instantiate-function-1.cpp3
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 66e61dd949..294f872988 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -875,10 +875,9 @@ Parser::OwningStmtResult Parser::ParseDoStatement(AttributeList *Attr) {
}
// Parse the parenthesized condition.
- OwningExprResult Cond(Actions);
- SourceLocation LPLoc, RPLoc;
- ParseParenExprOrCondition(Cond, true, &LPLoc, &RPLoc);
-
+ SourceLocation LPLoc = ConsumeParen();
+ OwningExprResult Cond = ParseExpression();
+ SourceLocation RPLoc = MatchRHSPunctuation(tok::r_paren, LPLoc);
DoScope.Exit();
if (Cond.isInvalid() || Body.isInvalid())
diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp
index 2749ec2440..a6c269febe 100644
--- a/test/SemaTemplate/instantiate-function-1.cpp
+++ b/test/SemaTemplate/instantiate-function-1.cpp
@@ -106,9 +106,6 @@ template<typename T> struct Do0 {
void f(T t) {
do {
} while (t); // expected-error{{not contextually}}
-
- do {
- } while (T t2 = T());
}
};