summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 513b9f684ee..38576ced309 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2715,6 +2715,11 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
}
C << nl << "bool __ok = __og.invoke();";
+
+ //
+ // Declare the return __ret variable at the top-level scope to
+ // enable NRVO with GCC (see also bug #3619).
+ //
writeAllocateCode(C, ParamDeclList(), ret, p->getMetaData(), _useWstring);
if(!p->returnsData())
{