diff --git a/tools/clang/lib/Sema/SemaCodeComplete.cpp b/tools/clang/lib/Sema/SemaCodeComplete.cpp index 4de7d42207..7001849426 100644 --- a/tools/clang/lib/Sema/SemaCodeComplete.cpp +++ b/tools/clang/lib/Sema/SemaCodeComplete.cpp @@ -4286,9 +4286,12 @@ static void mergeCandidatesWithResults(Sema &SemaRef, }); // Add the remaining viable overload candidates as code-completion results. - for (auto &Candidate : CandidateSet) + for (auto &Candidate : CandidateSet) { + if (Candidate.Function && Candidate.Function->isDeleted()) + continue; if (Candidate.Viable) Results.push_back(ResultCandidate(Candidate.Function)); + } } } diff --git a/tools/clang/test/Index/complete-constructor-params.cpp b/tools/clang/test/Index/complete-constructor-params.cpp index 6685626a58..949077a214 100644 --- a/tools/clang/test/Index/complete-constructor-params.cpp +++ b/tools/clang/test/Index/complete-constructor-params.cpp @@ -18,6 +18,20 @@ int main() { int(42); } +struct Foo { + Foo() = default; + Foo(const Foo&) = delete; +}; + +struct Bar { + Foo f; +}; + +void function() { + Bar b1; + Bar b2(b1); +} + // RUN: c-index-test -code-completion-at=%s:11:10 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter const S &}{RightParen )} (1) // CHECK-CC1: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder U}{Comma , }{Placeholder U}{RightParen )} (1) @@ -138,3 +152,6 @@ int main() { // CHECK-CC10-NEXT: Class name // CHECK-CC10-NEXT: Nested name specifier // CHECK-CC10-NEXT: Objective-C interface + +// RUN: c-index-test -code-completion-at=%s:32:12 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC11 %s +// CHECK-CC11-NOT: OverloadCandidate:{Text Bar}{LeftParen (}{CurrentParameter const Bar &}{RightParen )} (1)