HaxeFoundation / HaxeFoundation/haxe
[cpp] inlined assignment of Dynamic to String enum argument
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
class Main {
public static function main() {
trace(f(new Main()));
}
public function new() {}
static inline function f(v:Dynamic) return Value(v);
}
enum E {
Value(s:String);
}
```
The `trace()` is just there so that the code isn't optimized away.
```
Error: Main.cpp
./src/Main.cpp(40): error C2664: 'E E_obj::Value(String)': cannot convert argument 1 from 'hx::ObjectPtr' to 'String'
./src/Main.cpp(40): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
```
The problematic line:
```cpp
HXDLIN( 3) ::E _hx_tmp1 = ::E_obj::Value( ::Main_obj::__alloc( HX_CTX ));
```
Seems to be a regression compared to Haxe 3.2.1.
Contributor guide
Assessment
This issue has not been assessed yet.