summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaOverload.cpp7
-rw-r--r--clang/test/CodeCompletion/signatures-crash.cpp15
2 files changed, 21 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 614b83d5248..928a982e1fc 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -6429,7 +6429,12 @@ void Sema::AddFunctionCandidates(const UnresolvedSetImpl &Fns,
if (Expr *E = Args[0]) {
// Use the explicit base to restrict the lookup:
ObjectType = E->getType();
- ObjectClassification = E->Classify(Context);
+ // Pointers in the object arguments are implicitly dereferenced, so we
+ // always classify them as l-values.
+ if (!ObjectType.isNull() && ObjectType->isPointerType())
+ ObjectClassification = Expr::Classification::makeSimpleLValue();
+ else
+ ObjectClassification = E->Classify(Context);
} // .. else there is an implicit base.
FunctionArgs = Args.slice(1);
}
diff --git a/clang/test/CodeCompletion/signatures-crash.cpp b/clang/test/CodeCompletion/signatures-crash.cpp
new file mode 100644
index 00000000000..c58ae0cc2fd
--- /dev/null
+++ b/clang/test/CodeCompletion/signatures-crash.cpp
@@ -0,0 +1,15 @@
+struct map {
+ void find(int);
+ void find();
+};
+
+int main() {
+ map *m;
+ m->find(10);
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:8:11 %s -o - | FileCheck %s
+ // CHECK: OVERLOAD: [#void#]find(<#int#>)
+
+ // Also check when the lhs is an explicit pr-value.
+ (m+0)->find(10);
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:15 %s -o - | FileCheck %s
+}
OpenPOWER on IntegriCloud