[Issue 9617] New: ulong.max is wrongly accepted by smaller signed parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 28 17:45:49 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9617
Summary: ulong.max is wrongly accepted by smaller signed
parameter
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-02-28 17:45:44 PST ---
This is wrong implicit conversion bug.
void main()
{
void f1(int) {}
void f2(short) {}
void f3(byte) {}
// Why these calls are accepted?
f1(ulong.max);
f2(ulong.max);
f3(ulong.max);
// But, if argument is not constant value, compilation fails.
ulong x;
//f1(x); // is not callable using argument types (ulong)
//f2(x); // is not callable using argument types (ulong)
//f3(x); // is not callable using argument types (ulong)
void f4(uint) {}
void f5(ushort) {}
void f6(ubyte) {}
// If parameter type is unsigned, it is collectly rejected
//f4(ulong.max); // is not callable using argument types (ulong)
//f5(ulong.max); // is not callable using argument types (ulong)
//f6(ulong.max); // is not callable using argument types (ulong)
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list