gsoap 2.8.24 added virtual dtors to all classes
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
The following testcase code, built with soapcpp2 -z1 -x test.h
:
struct xsd__base64Binary { unsigned char *__ptr; int __size; }; struct action { unsigned int flags; int __union; union _act { struct _moveCopy { struct xsd__base64Binary store; } moveCopy; unsigned int bouncecode; } act; };
This was fine with gsoap-2.8.23. Something changed in gsoap-2.8.24 which added a virtual destructor to like everything, and because that makes the structs nontrivial, eventually causes the generated C++ to fail to build now:
$ soapcpp2 -z1 -x test.h [...] test.h: *WARNING*: struct '_moveCopy' cannot be assigned a default constructor because it is used as a member of union '_act' [...] $ g++ -c soapC.cpp [...] soapStub.h: In destructor 'virtual action::~action()': soapStub.h:98:20: error: use of deleted function '_act::~_act()' virtual ~action() { } ^ soapStub.h:77:7: note: '_act::~_act()' is implicitly deleted because the default definition would be ill-formed: union _act ^~~~ soapStub.h:80:19: error: union member '_act::moveCopy' with non-trivial '_moveCopy::~_moveCopy()' struct _moveCopy moveCopy; ^~~~~~~~ [...]
What fixes is needed?
The default virtual destructors are removed from structs in version 2.8.28.
unfortunately the test code given by jan still doesn't seem to compile, but with a different error:
The gSOAP code generator for C and C++, soapcpp2 release 2.8.29
..
test.h(17): WARNING: struct '_moveCopy' cannot be assigned a default constructor because it is used as a member of union '_act'
..
Compilation successful (1 warning)
root@akeminjo:~# g++ soapC.cpp -lgsoap
In file included from soapH.h:16:0,
from soapC.cpp:19:
soapStub.h:86:26: error: member ‘_moveCopy _act::moveCopy’ with constructor not allowed in union
struct _moveCopy moveCopy;
^
soapStub.h:86:26: note: unrestricted unions only available with -std=c++11 or -std=gnu++11