Wire up delayed typo correction to DiagnoseEmptyLookup and set up
Sema::ActOnIdExpression to use the new functionality.

Among other things, this allows recovery in several cases where it
wasn't possible before (e.g. correcting a mistyped static_cast<>).

llvm-svn: 222464
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 0d2d603..0b9608a 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -371,6 +371,23 @@
     return StmtError();
   }
 
+  ExprResult LHS =
+      CorrectDelayedTyposInExpr(LHSVal, [this](class Expr *E) {
+        if (!getLangOpts().CPlusPlus11)
+          return VerifyIntegerConstantExpression(E);
+        if (Expr *CondExpr =
+                getCurFunction()->SwitchStack.back()->getCond()) {
+          QualType CondType = CondExpr->getType();
+          llvm::APSInt TempVal;
+          return CheckConvertedConstantExpression(E, CondType, TempVal,
+                                                        CCEK_CaseValue);
+        }
+        return ExprError();
+      });
+  if (LHS.isInvalid())
+    return StmtError();
+  LHSVal = LHS.get();
+
   if (!getLangOpts().CPlusPlus11) {
     // C99 6.8.4.2p3: The expression shall be an integer constant.
     // However, GCC allows any evaluatable integer expression.
@@ -388,7 +405,7 @@
     }
   }
 
-  auto LHS = ActOnFinishFullExpr(LHSVal, LHSVal->getExprLoc(), false,
+  LHS = ActOnFinishFullExpr(LHSVal, LHSVal->getExprLoc(), false,
                                  getLangOpts().CPlusPlus11);
   if (LHS.isInvalid())
     return StmtError();