Closed excaliburtb closed 7 months ago
If extending all the way up to sim objects in S_define, then should not produce error https://nasa.github.io/trick/documentation/building_a_simulation/Model-Source-Code.html#noncopyable-objects
oh yes, I had that in the original sim with the issue. Let me resubmit the example with the sim object class also private constructor and assignment operator
SWIG 4.2? SWIG 4.1.1 works ok for me on Mac. SWIG 4.2 would have set wrapper for private operator /constructor
redhat 8 standard swig install of 3.0.12
looks like we can do a workaround of using:
##ifdef SWIG
%immutable;
##endif
VehicleOne & aliasTestObject;
##ifdef SWIG
%mutable;
##endif
but obviously it would be better if swig or Trick (whoever is to blame) didn't require it.
Ok, when I was testing, didn't test member initializing with constructor so didn't see the error. I saw the error with following:
class VehicleOneSimObject : public Trick::SimObject{ public: VehicleOne testObject; VehicleOne & aliasTestObject; VehicleOneSimObject() : aliasTestObject(testObject) { } ...
Making VehicleOne & aliasTestObject
not public won't produce error:
class VehicleOneSimObject : public Trick::SimObject{
VehicleOne & aliasTestObject;
public:
VehicleOne testObject;
VehicleOneSimObject() : aliasTestObject(testObject)
{
}
looks like we can do a workaround of using:
##ifdef SWIG %immutable; ##endif VehicleOne & aliasTestObject; ##ifdef SWIG %mutable; ##endif
but obviously it would be better if swig or Trick (whoever is to blame) didn't require it.
Good to know about the workaround. S_source_py.cpp is auto generated by SWIG, so I'd say because swig requires it ;-)
The workaround mentioned above is the official guidance offered by SWIG itself for this issue, so I'm going to close this as "not Trick's fault."
Looks like this might be a SWIG bug.
As the title says:
swig is generating a setter for a reference in the S_define but the referenced type has a private unimplemented copy constructor and assignment operator:
See the following example sim: (removed as it had an error. See comment below for updated example sim.)
Error produced is:
This could be a swig issue but confirmation would be nice.