move broken example to derived_byvalue.i since it could take long to fix
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6369 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7797e94739
commit
e88bf78833
3 changed files with 44 additions and 28 deletions
|
|
@ -46,6 +46,7 @@ LIBPREFIX = lib
|
||||||
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
|
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
|
||||||
CPP_TEST_BROKEN += \
|
CPP_TEST_BROKEN += \
|
||||||
derived_nested \
|
derived_nested \
|
||||||
|
derived_byvalue \
|
||||||
multiple_inheritance \
|
multiple_inheritance \
|
||||||
namespace_union \
|
namespace_union \
|
||||||
overload_complicated \
|
overload_complicated \
|
||||||
|
|
@ -301,6 +302,7 @@ C_TEST_CASES += \
|
||||||
enums \
|
enums \
|
||||||
function_typedef \
|
function_typedef \
|
||||||
inctest \
|
inctest \
|
||||||
|
lextype \
|
||||||
lib_carrays \
|
lib_carrays \
|
||||||
lib_cdata \
|
lib_cdata \
|
||||||
lib_cmalloc \
|
lib_cmalloc \
|
||||||
|
|
|
||||||
41
SWIG/Examples/test-suite/derived_byvalue.i
Normal file
41
SWIG/Examples/test-suite/derived_byvalue.i
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
%module derived_byvalue
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
struct Foo {
|
||||||
|
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 {
|
||||||
|
Foo a;
|
||||||
|
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 {
|
||||||
|
};
|
||||||
|
|
||||||
|
#
|
||||||
|
%}
|
||||||
|
|
@ -3,13 +3,7 @@
|
||||||
%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 {
|
||||||
|
|
@ -17,25 +11,4 @@ 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