HaxeFoundation / HaxeFoundation/haxe

[cpp] Null<UInt> null check fails

Open
#9,480 2 comments 0 reactions 0 assignees View on GitHub
regression
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Haxe code:

```haxe
class Test {
static function test (color : Null = null) {
trace (color != null ? 'not null' : 'null');
}
static function main() {
test ();
}
}
```

Haxe 3.4.7 output:
js: null
cpp: null

Generated cpp code:
```cpp
HXDLIN( 4) ::Dynamic _hx_tmp;
HXDLIN( 4) if (hx::IsNotNull( color )) {
HXDLIN( 4) _hx_tmp = HX_("not null",b4,90,c2,b2);
} else {
HXDLIN( 4) _hx_tmp = HX_("null",87,9e,0e,49);
}
```

Haxe 4.1.1 output:
js: null
cpp: **not null**

Generated cpp code:
```cpp
HXDLIN( 4) ::Dynamic b = null();
HXDLIN( 4) if (::hx::IsNotEq( ( (int)(color) ),b )) {
HXDLIN( 4) _hx_tmp = HX_("not null",b4,90,c2,b2);
}
else {
HXDLIN( 4) _hx_tmp = HX_("null",87,9e,0e,49);
}
```

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.