Merge pull request #235 from dontpanic92/master
Go: fix overload functions with polymorphic
This commit is contained in:
commit
da7133aa8e
4 changed files with 35 additions and 1 deletions
|
|
@ -310,6 +310,7 @@ CPP_TEST_CASES += \
|
||||||
overload_extend \
|
overload_extend \
|
||||||
overload_method \
|
overload_method \
|
||||||
overload_numeric \
|
overload_numeric \
|
||||||
|
overload_polymorphic \
|
||||||
overload_rename \
|
overload_rename \
|
||||||
overload_return_type \
|
overload_return_type \
|
||||||
overload_simple \
|
overload_simple \
|
||||||
|
|
|
||||||
11
Examples/test-suite/go/overload_polymorphic_runme.go
Normal file
11
Examples/test-suite/go/overload_polymorphic_runme.go
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "./overload_polymorphic"
|
||||||
|
|
||||||
|
func main(){
|
||||||
|
t := overload_polymorphic.NewDerived()
|
||||||
|
|
||||||
|
if overload_polymorphic.Test(t) != 0 {
|
||||||
|
panic("failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Examples/test-suite/overload_polymorphic.i
Normal file
22
Examples/test-suite/overload_polymorphic.i
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
%module overload_polymorphic
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
class Base {
|
||||||
|
public:
|
||||||
|
Base(){}
|
||||||
|
virtual ~Base(){}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Derived : public Base {
|
||||||
|
public:
|
||||||
|
Derived(){}
|
||||||
|
virtual ~Derived(){}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int test(Base* base){ return 0;}
|
||||||
|
int test(int hello){ return 1; }
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
@ -4414,7 +4414,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
fn = i + 1;
|
fn = i + 1;
|
||||||
Printf(f_go_wrappers, "\t\tif _, ok := a[%d].(%s); !ok {\n", j, tm);
|
Printf(f_go_wrappers, "\t\tif _, ok := a[%d].(%s); !ok {\n", j, goType(pj, Getattr(pj, "type")));
|
||||||
Printf(f_go_wrappers, "\t\t\tgoto check_%d\n", fn);
|
Printf(f_go_wrappers, "\t\t\tgoto check_%d\n", fn);
|
||||||
Printv(f_go_wrappers, "\t\t}\n", NULL);
|
Printv(f_go_wrappers, "\t\t}\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue