From aeb275aed3db271ee854f29e9b62806fe496255c Mon Sep 17 00:00:00 2001 From: Joe George Date: Wed, 13 Jul 2016 15:56:07 -0400 Subject: Some ice_tuple fixes - ice_tuple now returns all data members from class base class --- cpp/src/Slice/CPlusPlusUtil.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp') 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"; out << nl << "struct StreamWriter" << (cpp11 ? "<" : "< ") << fullName << ", S>"; -- cgit v1.2.3