]> granicus.if.org Git - clang/commitdiff
Diagnose delayed typos in an expr list that is in an invalid expression.
authorKaelyn Takata <rikka@google.com>
Fri, 27 Mar 2015 01:44:47 +0000 (01:44 +0000)
committerKaelyn Takata <rikka@google.com>
Fri, 27 Mar 2015 01:44:47 +0000 (01:44 +0000)
Previously, if the expr list parsed fine but the expr to the left of the
open parenthesis was invalid (when parsing the suffix of a
postfix-expression), the parsed expr list was just ignored.

Fixes PR23005.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233347 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
test/SemaCXX/typo-correction-delayed.cpp

index b9127e90457a144ae50d21c5ee86539c4f5220c7..72af14d068f2c0f98a58dab030da30cae07589a3 100644 (file)
@@ -1459,6 +1459,9 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
              })) {
             (void)Actions.CorrectDelayedTyposInExpr(LHS);
             LHS = ExprError();
+          } else if (LHS.isInvalid()) {
+            for (auto &E : ArgExprs)
+              Actions.CorrectDelayedTyposInExpr(E);
           }
         }
       }
index 64e6dd5966a2e6f007aefba46d42fece82413f55..3866a8a4cb72130ab2b5a9d52829931a5f5e79b2 100644 (file)
@@ -193,3 +193,8 @@ void f() {
   TimeTicks::now();  // expected-error {{no member named 'now' in 'PR22297::TimeTicks'; did you mean 'Now'?}}
 }
 }
+
+namespace PR23005 {
+void f() { int a = Unknown::b(c); }  // expected-error {{use of undeclared identifier 'Unknown'}}
+// expected-error@-1 {{use of undeclared identifier 'c'}}
+}