Skip to content

--gc:arc: catch doesn't work with exception subclassing #13072

Closed
@timotheecour

Description

@timotheecour

bug 1:

  • --gc:arc: catch ParentException doesn't work with exception subclassing

bug 2:

  • nim cpp --gc:arc doesn't work either even without exception subclassing

Example

  type MyExcept = object of CatchableError
  proc gun()=
    raise newException(MyExcept, "some msg")
  proc fun()=
    try:
      gun()
    except CatchableError: # BUG with --gc:arc (regardless of c/cpp or --exceptions:goto/setmp
    # except Exception: # ditto
    # except MyExcept: # OK with `nim c --gc:arc --exceptions:goto` and `nim c --gc:arc --exceptions:setjmp`; BUG with `nim cpp --gc:arc
      echo "caught1"
  fun()

Current Output

/Users/timothee/git_clone/nim/timn/tests/nim/all/t0900.nim(94) t0900
/Users/timothee/git_clone/nim/timn/tests/nim/all/t0900.nim(89) fun
/Users/timothee/git_clone/nim/timn/tests/nim/all/t0900.nim(86) gun
Error: unhandled exception: some msg [MyExcept]

Expected Output

caught1

Additional Information

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

    Issue actions