Skip to content

error: non-void function 'handle' should return a value [-Wreturn-mismatch] #1247

@barisyild

Description

@barisyild

I noticed a bug in hxcpp code generation.

Code

package;

class Test {
	static function main() {
		trace(new TestHandler());
	}
}

class TestHandler extends AbstractHandler<Void> {
	public function handle():Void {
		var keys = [];
		if (keys.length == 0) {
			return;
		}
	}
}

abstract class AbstractHandler<T> {
	public function new() {}

	public abstract function handle():T;
}

Exception

Error: ./src/TestHandler.cpp:40:15: error: non-void function 'handle' should return a value [-Wreturn-mismatch]
   40 | HXDLIN(  13)            return;
      |                         ^
1 error generated

Environment

hxcpp 4.3.96
haxe 4.3.6
MacOS

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