Lesson learned: Do Not Store rvalue Reference Outlive its Declaration
I am building a custom operator overloading structures in C++, and was really seduced with what rvalue promises: the lifetime of rvalue reference is bound to the expression of its context. Rvalue references can be used to extend the lifetimes of temporary objects (cppreference.com) I was building a combination of operators which accepts a lot of literals and temporary objects including lambda. So for instance: auto res = ObjectA() *...