auto Result = BaseTransform::RebuildCallExpr(Callee, LParenLoc, Args,
RParenLoc, ExecConfig);
if (auto *OE = dyn_cast<OverloadExpr>(Callee)) {
- if (!Result.isInvalid() && Result.get())
- OverloadResolution[OE] = cast<CallExpr>(Result.get())->getCallee();
+ if (!Result.isInvalid() && Result.get()) {
+ Expr *ResultCall = Result.get();
+ if (auto *BE = dyn_cast<CXXBindTemporaryExpr>(ResultCall))
+ ResultCall = BE->getSubExpr();
+ if (auto *CE = dyn_cast<CallExpr>(ResultCall))
+ OverloadResolution[OE] = CE->getCallee();
+ }
}
return Result;
}
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() {
+ // 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);
+}