[D] Fix occasional undefined behaviour with inheritance hierarchies

Particularly when using virtual inheritance as the pointers weren't
correctly upcast from derived class to base class when stored in the
base's proxy class.

Fixes commented out test code in cpp11_std_unique_ptr_runme
and li_std_auto_ptr_runme D tests.
This commit is contained in:
William S Fulton 2022-08-05 19:36:54 +01:00
commit 910fd1e3cf
8 changed files with 73 additions and 12 deletions

View file

@ -3402,7 +3402,7 @@ private:
} else {
Printv(upcasts_code,
"SWIGEXPORT ", baseclassname, " * ", upcast_wrapper_name,
"(", baseclassname, " *objectRef) {\n",
"(", classname, " *objectRef) {\n",
" return (", baseclassname, " *)objectRef;\n"
"}\n",
"\n", NIL);