Skip to content

Internal error on ARC/ORC when using forward declaration of finalizer proc #19401

@arkanoid87

Description

@arkanoid87

Example

compile with --gc:arc

type Foo = ref object
proc delete(self: Foo) 
proc newFoo: Foo = new(result, delete)
proc delete(self: Foo) = echo("delete Foo")

if isMainModule:
  proc test() = discard newFoo()
  test()

Current Output

Error: internal error: expr: proc not init delete

Expected Output

delete foo

Additional Information

Tested nim version 1.4.2 up to devel (15e3813)

If using type Foo = ref object of RootObj the problem is different: code compiles but silently skips finalizer call. I'm opening an independent issue for that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions