It would be cool if we could do overload resolution to suggest
the right function, but at least this fixes the crashing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134976
91177308-0d34-0410-b5e6-
96231b3b80d8
std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions()));
R.setLookupName(Corrected.getCorrection());
- if (!Corrected.isKeyword()) {
- NamedDecl *ND = Corrected.getCorrectionDecl();
+ if (NamedDecl *ND = Corrected.getCorrectionDecl()) {
R.addDecl(ND);
if (isa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND)) {
if (SS.isEmpty())
case LookupResult::FoundOverloaded:
case LookupResult::FoundUnresolvedValue:
I->second.setCorrectionDecl(TmpRes.getAsSingle<NamedDecl>());
+ // FIXME: This sets the CorrectionDecl to NULL for overloaded functions.
+ // It would be nice to find the right one with overload resolution.
++I;
break;
}
// wasn't actually in scope.
if (ED == 0 && Result.isKeyword()) return TypoCorrection();
- assert(Result.isResolved() && "correction has not been looked up");
// Record the correction for unqualified lookup.
if (IsUnqualifiedLookup)
UnqualifiedTyposCorrected[Typo] = Result;
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR10283
+void min();
+void min(int);
+
+template <typename T> void max(T);
+
+void f() {
+ fin(); //expected-error {{use of undeclared identifier 'fin'; did you mean 'min'}}
+ fax(0); //expected-error {{use of undeclared identifier 'fax'; did you mean 'max'}}
+}