ReaderSource passes a temporary PrincipalMaker even though it is required outside the constructor.
The constructor of
ReaderSource passes a temporary
PrincipalMaker to the constructor of the detail object by
const &. However, the detail object is intended to save this for use in its
getNext_ function. The detail class author is intended to save this by value as a class data member since it is a fairly lightweight object, but there are no explicit instructions to this effect and it is not intuitively obvious that this needs to be done.
The consequence of doing this wrong (eg saving a
PrincipalMaker const & in class data) is a hard-to-trace segfault in the guts of the construction of the first
PrincipalMaker should be saved as class data in ReaderSource, and the lifetime issue will therefore not arise, however the detail class author decides to hang on to a