Implement feedback on r224172 in PR21899
authorReid Kleckner <reid@kleckner.net>
Sat, 13 Dec 2014 01:11:23 +0000 (01:11 +0000)
committerReid Kleckner <reid@kleckner.net>
Sat, 13 Dec 2014 01:11:23 +0000 (01:11 +0000)
Based on suggestions from Kaelyn.

llvm-svn: 224173

clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/typo-correction-delayed.cpp

index 554e8c9..ad376f1 100644 (file)
@@ -6105,7 +6105,7 @@ public:
     auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
                                                  RParenLoc, ExecConfig);
     if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
-      if (!Result.isInvalid() && Result.get()) {
+      if (Result.isUsable()) {
         Expr *ResultCall = Result.get();
         if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
           ResultCall = BE->getSubExpr();
index d42888f..7879d29 100644 (file)
@@ -120,22 +120,13 @@ public:
   explicit SomeClass() : Kind(kSum) {}  // expected-error {{use of undeclared identifier 'kSum'; did you mean 'kNum'?}}
 };
 
-extern "C" int printf(const char *, ...);
-
 // There used to be an issue with typo resolution inside overloads.
-struct AssertionResult {
-  ~AssertionResult();
-  operator bool();
-  int val;
-};
-AssertionResult Compare(const char *a, const char *b);
-AssertionResult Compare(int a, int b);
-int main() {
+struct AssertionResult { ~AssertionResult(); };
+AssertionResult Overload(const char *a);
+AssertionResult Overload(int a);
+void UseOverload() {
   // expected-note@+1 {{'result' declared here}}
   const char *result;
   // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean 'result'?}}
-  if (AssertionResult ar = (Compare("value1", resulta)))
-    ;
-  else
-    printf("ar: %d\n", ar.val);
+  Overload(resulta);
 }