summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
-rw-r--r--clang/test/CodeGenCXX/temp-1.cpp23
2 files changed, 20 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5f1467c733c..ef172e5937d 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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/clang/test/CodeGenCXX/temp-1.cpp b/clang/test/CodeGenCXX/temp-1.cpp
index 11b83d333b7..21b3e543293 100644
--- a/clang/test/CodeGenCXX/temp-1.cpp
+++ b/clang/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();
+}
+
OpenPOWER on IntegriCloud