From a303f9eab9ceb356a24d84e178d079f0d41ad8d4 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 16 Aug 2009 03:53:54 +0000 Subject: [PATCH] Call MaybeBindToTemporary when constructing functino call operator calls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79172 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaOverload.cpp | 2 +- test/CodeGenCXX/temp-1.cpp | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 2b507fb303..d4187f2ce1 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/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/test/CodeGenCXX/temp-1.cpp b/test/CodeGenCXX/temp-1.cpp index 1edcae4acf..737bf65b47 100644 --- a/test/CodeGenCXX/temp-1.cpp +++ b/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()(); +} -- 2.50.1