bind: skip incompatible constructors in ObjC bindings

Fixes golang/go#21523

Change-Id: I1244e296ac4eeb0d10847e73216e4a25a3533292
Reviewed-on: https://go-review.googlesource.com/101115
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/bind/genobjc.go b/bind/genobjc.go
index 8c8ff85..f3697ea 100644
--- a/bind/genobjc.go
+++ b/bind/genobjc.go
@@ -1161,6 +1161,10 @@
 	cons := g.constructors[obj]
 	if oinf == nil {
 		for _, f := range cons {
+			if !g.isSigSupported(f.Type()) {
+				g.Printf("// skipped constructor %s.%s with unsupported parameter or return types\n\n", obj, f.Name())
+				continue
+			}
 			g.genInitM(obj, f)
 		}
 	}
diff --git a/bind/testdata/testpkg/testpkg.go b/bind/testdata/testpkg/testpkg.go
index e4ab40a..86739fd 100644
--- a/bind/testdata/testpkg/testpkg.go
+++ b/bind/testdata/testpkg/testpkg.go
@@ -9,6 +9,7 @@
 //go:generate gobind -lang=go -outdir=go_testpkg .
 //go:generate gobind -lang=java -outdir=. .
 import (
+	"context"
 	"errors"
 	"fmt"
 	"io/ioutil"
@@ -609,3 +610,11 @@
 type Testpkg interface{}
 
 func ClashingParameterFromOtherPackage(_ *secondpkg.Secondpkg) {}
+
+type MyStruct struct {
+}
+
+// Test that constructors with incompatible signatures are ignored.
+func NewMyStruct(ctx context.Context) *MyStruct {
+	return nil
+}