summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CPlusPlusUtil.cpp
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2015-12-29 14:42:15 -0500
committerJoe George <joe@zeroc.com>2015-12-29 14:45:23 -0500
commit6cf97628982b6a0ab7063009f92ac81b3c84e0d1 (patch)
tree8370194405d1a7a51967774fb41c0008f4d53ffc /cpp/src/Slice/CPlusPlusUtil.cpp
parentFix IceBT C++11 build (diff)
downloadice-6cf97628982b6a0ab7063009f92ac81b3c84e0d1.tar.bz2
ice-6cf97628982b6a0ab7063009f92ac81b3c84e0d1.tar.xz
ice-6cf97628982b6a0ab7063009f92ac81b3c84e0d1.zip
Fix ICE-6947
Pass in-parameters for local interfaces with delegate metadata by value in C++11
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index bfc21c2cb46..dda3930be9e 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -709,8 +709,7 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
"::std::shared_ptr<void>",
"::std::shared_ptr<::Ice::Value>"
};
-
-
+
typeCtx |= TypeContextInParam;
if(optional)
@@ -790,6 +789,10 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
{
return classDefToDelegateString(cl->definition(), typeCtx, cpp11);
}
+ else if(typeCtx & TypeContextDelegate)
+ {
+ return "::std::shared_ptr<" + fixKwd(cl->scoped()) + ">";
+ }
else
{
return "const ::std::shared_ptr<" + fixKwd(cl->scoped()) + ">&";
@@ -886,7 +889,7 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
{
t = "::std::shared_ptr<" + fixKwd(proxy->_class()->scoped() + "Prx") + ">";
}
-
+
return (typeCtx & TypeContextAMD) ? ("const " + t + "&") : t;
}
}
@@ -1553,6 +1556,14 @@ Slice::classDefToDelegateString(const ClassDefPtr& cl, int typeCtx, bool cpp11)
string t = "::std::function<" + retS + " (";
+ if(cpp11)
+ {
+ // inputTypeToString usually passes local operation values by
+ // reference. This is not the desired behavior for delegates
+ typeCtx &= ~TypeContextLocalOperation;
+ typeCtx |= TypeContextDelegate;
+ }
+
ParamDeclList paramList = cl->allOperations().front()->parameters();
for(ParamDeclList::iterator q = paramList.begin(); q != paramList.end(); ++q)
{