summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index dff1f3c31aa..cffcff2bafe 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -3326,7 +3326,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
H << eb << ';';
- if(!p->isAbstract() && !_doneStaticSymbol)
+ if(!p->isAbstract() && !p->isLocal() && !_doneStaticSymbol)
{
//
// We need an instance here to trigger initialization if the implementation is in a shared library.
@@ -3355,6 +3355,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
H << sp << nl << "static " << p->name() << "__staticInit _" << p->name() << "_init;";
H.zeroIndent();
+ H << nl << "#else";
+ H.restoreIndent();
+
+ H << nl << "static auto _" << p->name() << "_init = " << p->scoped() << "::ice_factory;";
+
+ H.zeroIndent();
H << nl << "#endif";
H.restoreIndent();
}