From 2dc0a8799e913bb37db8c5895f00f4dda920df62 Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 6 Jun 2019 19:24:20 +0200 Subject: Fix Incorrect generated code for class implements interface Close #406 --- cpp/src/slice2cpp/Gen.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 6315c900650..2b65602d59b 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -6740,12 +6740,17 @@ Slice::Gen::Cpp11ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) writeDocSummary(H, p); H << nl << "class " << _dllClassExport << p->name() << "Prx : public virtual " << getUnqualified("::Ice::Proxy", scope) << "<" << fixKwd(p->name() + "Prx") << ", "; - if(bases.empty() || (base && base->allOperations().empty())) + if(bases.empty() || (bases.size() == 1 && base && base->allOperations().empty())) { H << getUnqualified("::Ice::ObjectPrx", scope); } else { + if(base && base->allOperations().empty()) + { + bases.pop_front(); + } + ClassList::const_iterator q = bases.begin(); while(q != bases.end()) { @@ -7870,12 +7875,17 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p) writeDocSummary(H, p); H << nl << "class " << _dllExport << name << " : "; H.useCurrentPosAsIndent(); - if(bases.empty() || (base && base->allOperations().empty())) + if(bases.empty() || (base && bases.size() == 1 && base->allOperations().empty())) { H << "public virtual " << getUnqualified("::Ice::Object", scope); } else { + if(base && base->allOperations().empty()) + { + bases.pop_front(); + } + ClassList::const_iterator q = bases.begin(); while(q != bases.end()) { -- cgit v1.2.3