HaxeFoundation / HaxeFoundation/haxe

[cpp] extern class with default args generates null args

Open
#3,955 2 comments 0 reactions 1 assignee Claimed by @hughsando View on GitHub
platform-cpp
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Extern classes with default args seem to generate `null()` for unspecified args in the generated C++.

As an example, for the function signature

``` Haxe
public function func(a:Int, b:Int = 1, c:cpp.Float32 = 1.0):Void;
```

and a function call

``` Haxe
e.func(10);
```

Haxe will generate the C++ of

``` c++
e->func((int)10,null(),null());
```

Full example, though the actual C++ will not build:

``` Haxe
package;

extern class ExternClass {

public function func(a:Int, b:Int = 1, c:cpp.Float32 = 1.0):Void;

}

class Main {

public static function main() {
}

public function test(e:ExternClass):Void {

e.func(10);

}

}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.