swig -go: treat a nil argument as NULL

Let Go code pass "nil" when calling a C++ function that accepts a
pointer to a class.  The Go "nil" will be treated as a C++ "nullptr".

Fixes #2203
This commit is contained in:
Ian Lance Taylor 2022-03-08 15:15:05 -08:00
commit 70d530adfc
4 changed files with 53 additions and 12 deletions

View file

@ -50,4 +50,8 @@ func main() {
fmt.Println("for c2.M got", pm, "want", want)
panic(pm)
}
c1 := go_inout.NewC1()
c2.M2(c1)
c2.M2(nil)
}

View file

@ -239,5 +239,7 @@ class C1 {
};
class C2 : public C1 {
public:
void M2(C1*) {}
};
%}