You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Binding an lvalue reference shouldn't cause a dangling reference.
Maybe I'm misunderstanding the library design here and it's expected that bound objects have a longer lifetime than the injector. It's definitely very easy to run into this problem. If I move the object into the binding the ownership is moved to the injector and everything is fine. I'm wondering if there's a way to make this problem more obvious or less easy to run into it.
Expected Behavior
Binding an lvalue reference shouldn't cause a dangling reference.
Maybe I'm misunderstanding the library design here and it's expected that bound objects have a longer lifetime than the injector. It's definitely very easy to run into this problem. If I move the object into the binding the ownership is moved to the injector and everything is fine. I'm wondering if there's a way to make this problem more obvious or less easy to run into it.
Actual Behavior
Reference to object is dangling.
Steps to Reproduce the Problem
Open the godbolt playground: https://godbolt.org/z/E5v4bhsE4
Specifications
The text was updated successfully, but these errors were encountered: