Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding to LValue Reference becomes dangling #553

Open
gotschmarcel-ni opened this issue Jun 20, 2023 · 0 comments
Open

Binding to LValue Reference becomes dangling #553

gotschmarcel-ni opened this issue Jun 20, 2023 · 0 comments

Comments

@gotschmarcel-ni
Copy link

gotschmarcel-ni commented Jun 20, 2023

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

  • Version: 1.2.0 & 1.3.0
  • Platform: macOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant