Closed mkolin closed 2 years ago
Technically speaking, the new behavior is correct: the return type from indexing the vector is const Base*&
, so a reference to the pointer, not a pointer by-value. When the temporary goes out of scope, so do the references to its pointers. Let me dig a bit.
Fixed in repo by distinguishing the behaviors between const and non-const. It fixes this report and doesn't break any tests, but there may still be corner cases lurking.
Awesome! Thanks for the quick turn around. A great library with great support.
Released with 2.4.0 and its dependencies.
The issue comes up when a function returns a vector with base pointers and that is converted to a list. The conversion from a temporary vector will seem like it will construct a list of invalid pointers.
Note keeping a reference to the vector will prevent any issues. When this happens, destructing the underlying vector will invalidate the list.
Example:
This functionality worked in 1.6.1.