aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-08-16 03:06:32 +0000
committerAnders Carlsson <andersca@mac.com>2009-08-16 03:06:32 +0000
commitec74c5929c78bd1670619022f6cfd471becf65aa (patch)
tree46fe3118688af7b3d2775a3471557fddb09e7cf8
parent4ec04c4e27b045f65541de7dffccbc04304a9b85 (diff)
Make sure to call MaybeBindToTemporary when creating CallExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79168 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/CodeGenCXX/temp-1.cpp23
2 files changed, 20 insertions, 5 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 5f1467c733..ef172e5937 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2942,7 +2942,7 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc,
return ExprError();
}
- return Owned(TheCall.take());
+ return MaybeBindToTemporary(TheCall.take());
}
Action::OwningExprResult
diff --git a/test/CodeGenCXX/temp-1.cpp b/test/CodeGenCXX/temp-1.cpp
index 11b83d333b..21b3e54329 100644
--- a/test/CodeGenCXX/temp-1.cpp
+++ b/test/CodeGenCXX/temp-1.cpp
@@ -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();
+}
+