diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 982f3f5be..47b0b7882 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -46,6 +46,7 @@ LIBPREFIX = lib # Broken C++ test cases. (Can be run individually using make testcase.cpptest.) CPP_TEST_BROKEN += \ derived_nested \ + derived_byvalue \ multiple_inheritance \ namespace_union \ overload_complicated \ @@ -301,6 +302,7 @@ C_TEST_CASES += \ enums \ function_typedef \ inctest \ + lextype \ lib_carrays \ lib_cdata \ lib_cmalloc \ diff --git a/Examples/test-suite/derived_byvalue.i b/Examples/test-suite/derived_byvalue.i new file mode 100644 index 000000000..ab675bbc5 --- /dev/null +++ b/Examples/test-suite/derived_byvalue.i @@ -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 { +}; + +# +%} diff --git a/Examples/test-suite/struct_value.i b/Examples/test-suite/struct_value.i index 9789497f3..bf944e2c5 100644 --- a/Examples/test-suite/struct_value.i +++ b/Examples/test-suite/struct_value.i @@ -3,13 +3,7 @@ %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; } + int x; }; struct Bar { @@ -17,25 +11,4 @@ struct Bar { 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 { -}; - -# %}