Merge branch 'python-stl-overloading'
* python-stl-overloading:
Python STL container method overloading fix
diff --git a/CHANGES.current b/CHANGES.current
index aeef3f5..53c4097 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,6 +7,9 @@
Version 4.0.1 (in progress)
===========================
+2019-08-08: rokups
+ [C#, Java] #1601 Fix invalid code generated for "%constant enum EnumType.
+
2019-08-07: wsfulton
[Python] Fix method overloading of methods that take STL containers of different
types. The following usage (using std::vector) would fail when using -builtin:
diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i
index b102ffe..3e4775d 100644
--- a/Examples/test-suite/constant_directive.i
+++ b/Examples/test-suite/constant_directive.i
@@ -14,6 +14,11 @@
Type1(int val = 0) : val(val) {}
int val;
};
+enum EnumType
+{
+ EnumValue
+};
+EnumType enumValue = EnumValue;
/* Typedefs for const Type and its pointer */
typedef const Type1 Type1Const;
typedef const Type1* Type1Cptr;
@@ -46,3 +51,4 @@
%constant Type1Cfptr TYPE1CFPTR1DEF_CONSTANT1 = getType1Instance;
/* Regular constant */
%constant int TYPE_INT = 0;
+%constant enum EnumType newValue = enumValue;
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 76ec6a4..17100b3 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -1533,7 +1533,7 @@
if (classname_substituted_flag) {
if (SwigType_isenum(t)) {
// This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
- Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+ Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
} else {
// This handles function pointers using the %constant directive
Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 259f23f..fcc8381 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -1633,7 +1633,7 @@
if (classname_substituted_flag) {
if (SwigType_isenum(t)) {
// This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on)
- Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname));
+ Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));
} else {
// This handles function pointers using the %constant directive
Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname));