From: Reid Kleckner Date: Sat, 13 Dec 2014 01:11:23 +0000 (+0000) Subject: Implement feedback on r224172 in PR21899 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35d74535f8fb6d7caf7ebe5b9ba0c027e8cd220f;p=clang Implement feedback on r224172 in PR21899 Based on suggestions from Kaelyn. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224173 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 554e8c9b8f..ad376f1254 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -6105,7 +6105,7 @@ public: auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args, RParenLoc, ExecConfig); if (auto *OE = dyn_cast(Callee)) { - if (!Result.isInvalid() && Result.get()) { + if (Result.isUsable()) { Expr *ResultCall = Result.get(); if (auto *BE = dyn_cast(ResultCall)) ResultCall = BE->getSubExpr(); diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp index d42888f1e6..7879d299d0 100644 --- a/test/SemaCXX/typo-correction-delayed.cpp +++ b/test/SemaCXX/typo-correction-delayed.cpp @@ -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); }