Skip to content

Passing continuation to function crashes compiler #7

@michael-kenzel

Description

@michael-kenzel

The following code will reproduce the issue:

fn test() {
	let blub = @|cont: fn()->()| {};

	while (true) {
		blub(continue)
	}
}

Compiling the above code results in:

terminate called after throwing an instance of 'std::bad_array_new_length'
  what():  std::bad_array_new_length

I assume this may be caused by the incorrect return type in the function type of the parameter the continuation is passed to.

One workaround seems to be wrapping the continuation in a lambda:

fn test() {
	let blub = @|cont: fn()->()| {};

	while (true) {
		blub(@||continue())
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions