Skip to content

Fix self-assignment bug in PolymorphicSmallObject

This MR addresses the following issues:

  • self-assignment results in destruction of data
  • PolymorphicSmallObject(PolymorphicSmallObject&) calls the main ctor instead of the move ctor
  • the buffer is not used when sizeof(Derived) == bufferSize

Changes:

  • add check for self-assignment in operator=
  • use buffer when object size is <= buffer size, not just when <
  • add unit test for PolymorphicSmallObject
  • add type check for main constructor
  • clarify interface requirements

Merge request reports