Olly Betts - 2022-03-16

Reproducible with current git master on Linux.

This patch at least prevents the crash:

diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx
index eb61752b..f7f6aea1 100644
--- a/Source/Modules/lang.cxx
+++ b/Source/Modules/lang.cxx
@@ -2466,8 +2466,11 @@ int Language::classDeclaration(Node *n) {
     cplus_mode = PUBLIC;
   }
   for (; outerClass; outerClass = Getattr(outerClass, "nested:outer")) {
-    Push(ClassPrefix, "_");
-    Push(ClassPrefix, Getattr(outerClass, "sym:name"));
+    String *outer_symname = Getattr(outerClass, "sym:name");
+    if (outer_symname) {
+      Push(ClassPrefix, "_");
+      Push(ClassPrefix, outer_symname);
+    }
   }
   EnumClassPrefix = Copy(ClassPrefix);
   if (strip) {

However with that applied the example gives some strange warnings about constructors and destructors which aren't explicitly in the example interface file:

$ ../preinst-swig -c++ -java test.i
test.i:7: Warning 504: Function Struct1::Struct1() must have a return type. Ignored.
test.i:7: Warning 521: Illegal destructor name Struct1::~Struct1(). Ignored.
test.i:11: Warning 504: Function Struct2::Struct2() must have a return type. Ignored.
test.i:11: Warning 521: Illegal destructor name Struct2::~Struct2(). Ignored.