Bug 19300 – cpp_(u)long(long) types trigger enum comparison error

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-10-11T15:17:59Z
Last change time
2024-12-13T19:00:52Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#19494 →

Comments

Comment #0 by code — 2018-10-11T15:17:59Z
cat > bug.d << CODE import core.stdc.config : cpp_ulong, cpp_ulonglong, cpp_long, cpp_longlong; bool bug(ulong a, long b) { return a == b; } bool bug(cpp_ulong a, cpp_long b) { return a == b; } bool bug(cpp_ulonglong a, cpp_longlong b) { return a == b; } CODE dmd -c bug.d ---- bug.d(15): Error: Comparison between different enumeration types __c_ulonglong and __c_longlong; If this behavior is intended consider using std.conv.asOriginalType ---- The exact error message depends on the platform. The types should behave like any other signed/unsigned types w.r.t. comparison. __c_ulonglong et.al. have been introduced as enums with magic mangling, thus comparison triggers those enum comparison errors.
Comment #1 by github-bugzilla — 2018-10-11T20:22:22Z
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8ca8f2e9e8cd4955ed457a68b1f870e50db1cf59 workaround Issue 19300 - due to relying on magic enums (cpp_ulonglong on OSX), plain comparison between targ_ullong and targ_llong is an error
Comment #2 by robert.schadek — 2024-12-13T19:00:52Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19494 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB