diff --git a/CHANGES.current b/CHANGES.current index 5e907a279..feb058706 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.1.0 (in progress) =========================== +2022-01-29: dontpanic92 + #676 Fix code generated for a C++ class with a non-capitalised + name. + 2022-01-26: trex58 #1919 #1921 #1923 Various fixes for AIX portability. diff --git a/Examples/test-suite/class_case.i b/Examples/test-suite/class_case.i new file mode 100644 index 000000000..e9438d80b --- /dev/null +++ b/Examples/test-suite/class_case.i @@ -0,0 +1,18 @@ +%module class_case + +// Regression test for SWIG/Go bug #676 + +%inline %{ + +class ClassA {}; + +class classB {}; +class classB2 : public classB {}; + +int Test1(ClassA* a) { return 1; } +int Test1(int i) { return 0; } + +int Test2(classB* a) { return 1; } +int Test2(int i) { return 0; } + +%} diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 6574c4549..19e5d170c 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -134,6 +134,7 @@ CPP_TEST_CASES += \ char_binary \ char_strings \ chartest \ + class_case \ class_scope_namespace \ class_forward \ class_ignore \ diff --git a/Examples/test-suite/go/class_case_runme.go b/Examples/test-suite/go/class_case_runme.go new file mode 100644 index 000000000..7d0870b47 --- /dev/null +++ b/Examples/test-suite/go/class_case_runme.go @@ -0,0 +1,12 @@ +package main + +import . "swigtests/class_case" + +func main() { + b2 := NewClassB2() + // This used to fail with: + // panic: interface conversion: interface {} is class_case.SwigcptrClassB2, not int + if Test2(b2) != 1 { + panic("Unexpected overload used") + } +}