add error when passing a struct/class by value + derivation
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6368 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8ab24227a9
commit
7fbced8eb1
1 changed files with 28 additions and 1 deletions
|
|
@ -3,7 +3,13 @@
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
struct Foo {
|
struct Foo {
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
// this works
|
||||||
|
int rmethod(const Foo& f) { return f.x; }
|
||||||
|
|
||||||
|
// this doesn't when DerFoo (below) is introduced
|
||||||
|
int method(Foo f) { return f.x; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Bar {
|
struct Bar {
|
||||||
|
|
@ -11,4 +17,25 @@ struct Bar {
|
||||||
struct Foo b;
|
struct Foo b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
When the next derived class is declared, the
|
||||||
|
following bad method is generated
|
||||||
|
|
||||||
|
static void *_DerFooTo_Foo(void *x) { // **** bad ****
|
||||||
|
return (void *)((Foo) ((DerFoo) x));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *_p_DerFooTo_p_Foo(void *x) { // *** good ***
|
||||||
|
return (void *)((Foo *) ((DerFoo *) x));
|
||||||
|
}
|
||||||
|
|
||||||
|
if the derived class is deleted, it works again
|
||||||
|
|
||||||
|
if the previos Foo::method
|
||||||
|
|
||||||
|
*/
|
||||||
|
struct DerFoo : Foo {
|
||||||
|
};
|
||||||
|
|
||||||
|
#
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue