Skip to content

catch block arguments #56

Open
Open
@cmazakas

Description

@cmazakas
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

Activity

seanbaxter

seanbaxter commented on Oct 2, 2024

@seanbaxter
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @seanbaxter@cmazakas

        Issue actions

          catch block arguments · Issue #56 · cppalliance/safe-cpp