HaxeFoundation / HaxeFoundation/haxe

@:isVar typed Null<Int> support on cpp ?

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

Description

I am not familiar with cpp, but it looks like a bug.

```haxe
class Main {
@:isVar public var level(get, set):Null;

static function main() {
trace("Hello World!");
}

function set_level(value:Int):Int
{
return level = value;
}

function get_level():Int
{
return level;
}
}
```

errors
```
haxelib run hxcpp Build.xml haxe -Ddebug -DHXCPP_M64="1" -Dhaxe3="1" -Dhaxe_ver="3.402" -Dhxcpp_api_level="331" -Dsource-header="Generated by Haxe 3.4.2" -I"/Users/user/Documents/GIT-REPOS/hexMachina/src/" -I"" -I"/Users/user/haxe/versions/3.4.2/std/cpp/_std/" -I"/Users/user/haxe/versions/3.4.2/std/"
Creating /Users/user/Documents/GIT-REPOS/hexMachina/bin/cpp/obj/darwin64-debug/__pch/haxe/hxcpp.h.gch...

Compiling group: haxe
g++ -Iinclude -c -fvisibility=hidden -stdlib=libstdc++ -Qunused-arguments -g -I/Users/user/haxe/haxelib/hxcpp/3,4,188/include -DHX_MACOS -m64 -Wno-parentheses -Wno-unused-value -Wno-format-extra-args -Wno-overflow -DHXCPP_DEBUG -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=331(haxe) ... tags=[haxe,static]
- src/Main.cpp
Error: ./src/Main.cpp:77:84: error: conditional expression is ambiguous; 'int' can be converted to '::Dynamic' and vice versa
if (HX_FIELD_EQ(inName,"level") ) { return hx::Val( inCallProp == hx::paccAlways ? get_level() : level ); }
^ ~~~~~~~~~~~ ~~~~~
1 error generated.
Error: Build failed
The terminal process terminated with exit code: 1
```

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.