]> granicus.if.org Git - clang/commitdiff
Call MaybeBindToTemporary when constructing functino call operator calls.
authorAnders Carlsson <andersca@mac.com>
Sun, 16 Aug 2009 03:53:54 +0000 (03:53 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 16 Aug 2009 03:53:54 +0000 (03:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79172 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/CodeGenCXX/temp-1.cpp

index 2b507fb303a01018587e8e174e4dae98e02de864..d4187f2ce1b8a31ff63786c7cbf97eccd2fcc6f6 100644 (file)
@@ -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->
index 1edcae4acfcc51a9b7496c99fc4c03f070cb4295..737bf65b47345ca65be665d7515219126a9513b9 100644 (file)
@@ -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()();
+}