]> granicus.if.org Git - clang/commitdiff
Make sure to call MaybeBindToTemporary when creating CallExprs.
authorAnders Carlsson <andersca@mac.com>
Sun, 16 Aug 2009 03:06:32 +0000 (03:06 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 16 Aug 2009 03:06:32 +0000 (03:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79168 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 5f1467c733c736c51f6fc0313b277d1759522342..ef172e5937d7d88c53e68f2f01206a5ba2778717 100644 (file)
@@ -2942,7 +2942,7 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc,
       return ExprError();
   }
 
-  return Owned(TheCall.take());
+  return MaybeBindToTemporary(TheCall.take());
 }
 
 Action::OwningExprResult
index 11b83d333b70f59bc3ef320fb935390328ec97cc..21b3e543293f7c99b889a3ec5f81dc41bb6ee323 100644 (file)
@@ -5,9 +5,24 @@ struct A {
   void f();
 };
 
-void f() {
-  // RUN: grep "call void @_ZN1AC1Ev" %t | count 2 &&
-  // RUN: grep "call void @_ZN1AD1Ev" %t | count 2
-  A();
+// RUN: grep "call void @_ZN1AC1Ev" %t | count 2 &&
+// RUN: grep "call void @_ZN1AD1Ev" %t | count 2 &&
+void f1() {
+  (void)A();
   A().f();
 }
+
+// Calls
+struct B {
+  B();
+  ~B();
+};
+
+B g();
+
+// RUN: grep "call void @_ZN1BC1Ev" %t | count 0 &&
+// RUN: grep "call void @_ZN1BD1Ev" %t | count 1
+void f2() {
+  (void)g();
+}
+