Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpp.Int64 -> haxe.Int64 silently converts to Int32 #10100

Closed
haxiomic opened this issue Feb 2, 2021 · 0 comments · Fixed by #10101
Closed

cpp.Int64 -> haxe.Int64 silently converts to Int32 #10100

haxiomic opened this issue Feb 2, 2021 · 0 comments · Fixed by #10101
Assignees
Milestone

Comments

@haxiomic
Copy link
Member

haxiomic commented Feb 2, 2021

Ran into this while trying to use haxe.Int64 to get the low and high bits of a cpp.Int64:

The following

var hx64: haxe.Int64 = (cpp64: cpp.Int64);

Generates

cpp::Int64Struct hx64 = ( ::cpp::Int64Struct(( (int)(cpp64) )))

Where the unexpected (int) cast means we lose the top 32 bits. This is because cpp.Int64 can auto-cast to Int and the haxe.Int64 abstract has auto-cast from Int but not Int64. A fix is to add an auto-cast from cpp.Int64

PR + regression test on the way

@haxiomic haxiomic self-assigned this Feb 2, 2021
@RealyUniqueName RealyUniqueName added this to the Release 4.2 milestone Feb 2, 2021
RealyUniqueName pushed a commit that referenced this issue Feb 3, 2021
* [cpp] support cpp.Int64 -> haxe.Int64 round-trip. Closes #10100

* [test] add regression test for Int64 roundtrip #10100

* try not using @:structAccess and cast instead

* Guard with #if cpp || cppia

* remove #if cppia

* Disable test on cppia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants