[Issue 19300] New: cpp_(u)long(long) types trigger enum comparison error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 11 15:17:59 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19300
Issue ID: 19300
Summary: cpp_(u)long(long) types trigger enum comparison error
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
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.
--
More information about the Digitalmars-d-bugs
mailing list