From: Douglas Gregor Date: Tue, 24 Nov 2009 21:34:32 +0000 (+0000) Subject: "Do" loops cannot have condition variables, so don't parse them. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04895d301e1107a8f03673c43c939a115c3c1195;p=clang "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 --- 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 struct Do0 { void f(T t) { do { } while (t); // expected-error{{not contextually}} - - do { - } while (T t2 = T()); } };