Skip to content

Make ContainedObject assignment consistent with copy construction

ContainedObject has an explicitly declared copy constructor (which 'does nothing'). Unfortunately, it does not have an explicit assignment operator, so the compiler will silently generate one -- but at least gcc9 will issue a warning about this. In this particular case, the compiler generated assignment will be wrong, as it will assign the 'parent container pointer', whilst assignment to a contained object will not somehow magically put it in the container of the rhs of the assignment, but keep it in its present container (if any). So the solution is to explicitly add an assignment operator that, like the copy constructor, does nothing...

Edited by Gerhard Raven

Merge request reports