summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaOverload.cpp2
-rw-r--r--clang/test/CodeGenCXX/temp-1.cpp15
2 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 2b507fb303a..d4187f2ce1b 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -4555,7 +4555,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
if (CheckFunctionCall(Method, TheCall.get()))
return true;
- return TheCall.release();
+ return MaybeBindToTemporary(TheCall.release()).release();
}
/// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator->
diff --git a/clang/test/CodeGenCXX/temp-1.cpp b/clang/test/CodeGenCXX/temp-1.cpp
index 1edcae4acfc..737bf65b473 100644
--- a/clang/test/CodeGenCXX/temp-1.cpp
+++ b/clang/test/CodeGenCXX/temp-1.cpp
@@ -35,10 +35,23 @@ struct C {
};
// RUN: grep "call void @_ZN1CC1Ev" %t | count 1 &&
-// RUN: grep "call void @_ZN1CD1Ev" %t | count 2
+// RUN: grep "call void @_ZN1CD1Ev" %t | count 2 &&
void f3() {
C().f();
}
+// Function call operator
+struct D {
+ D();
+ ~D();
+
+ D operator()();
+};
+
+// RUN: grep "call void @_ZN1DC1Ev" %t | count 1 &&
+// RUN: grep "call void @_ZN1DD1Ev" %t | count 2
+void f4() {
+ D()();
+}
OpenPOWER on IntegriCloud