PlRecord needs to define move constructor (possibly other classes as well)
All classes that contain a pointer or similar need to define a move constructor as well as a copy constructor because the default move constructor doesn't do the right thing. E.g., for PlRecord, both the copy and move constructors need to call Plx_duplicate_record(), and then the destructor can call Plx_erase(). (Need to do some experimentation to determine if the move constructor should also zero the record_t field, which is checked in the destructor before calling Plx_erase().) (It might be necessary to keep a separate reference count in PlRecord.
It's not clear what PlQuery needs, but probably it also doesn't work properly with the default move constructor.
These changes are not in https://github.com/SWI-Prolog/packages-cpp/pull/39 - for the time being, I suggest documenting the problem because the correct fixes are not obvious.
The move constructors have been added, but leaving this open because PlRecord should act like a "smart pointer", taking advantage of the way PL_duplicate_record() and PL_erase() work (with reference counts). For now, PlRecord has been renamed to PlRecordRaw, to emphasize that it isn't "smart".