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

catch block arguments #56

Open
cmazakas opened this issue Sep 18, 2024 · 1 comment
Open

catch block arguments #56

cmazakas opened this issue Sep 18, 2024 · 1 comment

Comments

@cmazakas
Copy link
Collaborator

In a catch block, if a thrown type has a non-trivial copy constructor, cpy isn't passively invoked for the user. See: https://godbolt.org/z/vfxPx5cWb

In the case of throwing a constructed object, the static constraint on references prevents this code from compiling as well: https://godbolt.org/z/T5o6TbWPz

@seanbaxter
Copy link
Collaborator

  1. Yes, need to specify how to support both cpy and other bindincs in the [safety] feature.
  2. An inaccurate error message but not a borrow checker bug. The exception object doesn't have static storage duration, so we can't bind static borrows to the exception object. I don't know what to do here. Maybe there needs to be a /throw lifetime? The exception object doesn't live on the stack, and it's not static... Is it sufficient to treat it as if it has automatic storage duration? I'd have to do some experiments to see if the __cxa_free_exception can occur prior to the closing brace of a catch-handler.

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

2 participants