summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CPlusPlusUtil.cpp
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2016-07-13 15:56:07 -0400
committerJoe George <joe@zeroc.com>2016-07-13 15:57:19 -0400
commitaeb275aed3db271ee854f29e9b62806fe496255c (patch)
tree9e5fb1ee82729c0579dac86fc9592f2717daf1cf /cpp/src/Slice/CPlusPlusUtil.cpp
parentVarious C++ cleanups (diff)
downloadice-aeb275aed3db271ee854f29e9b62806fe496255c.tar.bz2
ice-aeb275aed3db271ee854f29e9b62806fe496255c.tar.xz
ice-aeb275aed3db271ee854f29e9b62806fe496255c.zip
Some ice_tuple fixes
- ice_tuple now returns all data members from class base class
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 8987d936763..57fdf1bf2ff 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -1442,12 +1442,17 @@ Slice::writeMarshalUnmarshalAllInHolder(IceUtilInternal::Output& out,
void
Slice::writeStreamHelpers(Output& out,
- bool checkClassMetaData,
- bool cpp11,
const ContainedPtr& c,
- DataMemberList dataMembers)
+ DataMemberList dataMembers,
+ bool hasBaseDataMembers,
+ bool checkClassMetaData,
+ bool cpp11)
{
- if(dataMembers.empty())
+ // If c is a C++11 class/exception whose base class contains data members (recursively), then we need to generate
+ // an StreamWriter even if its implementation is empty. This is becuase our default marsaling uses ice_tuple() which
+ // contains all of our class/exception's data members as well the base data members, which breaks marshaling. This
+ // is not an issue for structs.
+ if(dataMembers.empty() && !(cpp11 && hasBaseDataMembers))
{
return;
}
@@ -1487,9 +1492,9 @@ Slice::writeStreamHelpers(Output& out,
// Generate StreamWriter
//
// Only generate StreamWriter specializations if we are generating for C++98 or
- // we are generating for C++11 with optional data members
+ // we are generating for C++11 with optional data members and no base class data members
//
- if(!cpp11 || !optionalMembers.empty())
+ if(!cpp11 || !optionalMembers.empty() || hasBaseDataMembers)
{
out << nl << "template<typename S>";
out << nl << "struct StreamWriter" << (cpp11 ? "<" : "< ") << fullName << ", S>";