[Issue 2626] template function not working against template struct instantiated with default arguments
http://d.puremagic.com/issues/show_bug.cgi?id=2626 --- Comment #1 from bugzi...@digitalmars.com 2009-02-28 04:11 --- Here's a simpler version, but fixing it isn't: struct S(int x = 1){} void fun()(S!(1) b) { } void main() { S!() s; fun(s); } --
[Issue 2696] New: Spurious ifclause of template function shown in error message
http://d.puremagic.com/issues/show_bug.cgi?id=2696 Summary: Spurious ifclause of template function shown in error message Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: and...@metalanguage.com (Thanks CLXX for submitting this to the newsgroup.) void fun(T)(T t) if (is(T == string)) {} void fun(T)(T t) if (is(T == int)) {} void main( ){ fun(1.0); } yields the errors: ./test.d(5): template test.fun(T) if (is(T == string)) does not match any function template declaration ./test.d(5): template test.fun(T) if (is(T == string)) cannot deduce template function from argument types !()(double) The if (...) clause is superfluous as the compiler seems to print there whatever fun overload was first in the module. The correct error message is: ./test.d(5): template test.fun(T) does not match any function template declaration ./test.d(5): template test.fun(T) cannot deduce template function from argument type !()(double) Notice the grammar fix too :o). --
[Issue 2697] New: Cast of float function return to ulong or uint gives bogus value
http://d.puremagic.com/issues/show_bug.cgi?id=2697 Summary: Cast of float function return to ulong or uint gives bogus value Product: D Version: 1.040 Platform: PC OS/Version: Windows Status: NEW Keywords: wrong-code Severity: major Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: s...@iname.com import std.stdio; float func() { return 5; } void main() { writefln(float: %f, func()); writefln(ulong: %d, cast(ulong) func()); writefln(long: %d, cast(long) func()); writefln(uint: %d, cast(uint) func()); writefln(int:%d, cast(int)func()); writefln(ushort: %d, cast(ushort) func()); writefln(short: %d, cast(short) func()); writefln(ubyte: %d, cast(ubyte) func()); writefln(byte: %d, cast(byte) func()); float result = func(); writefln(float: %f, result); writefln(ulong: %d, cast(ulong) result); writefln(long: %d, cast(long) result); writefln(uint: %d, cast(uint) result); writefln(int:%d, cast(int)result); writefln(ushort: %d, cast(ushort) result); writefln(short: %d, cast(short) result); writefln(ubyte: %d, cast(ubyte) result); writefln(byte: %d, cast(byte) result); } -- float: 5.00 ulong: 2048 long: 5 uint: 0 int:5 ushort: 5 short: 5 ubyte: 5 byte: 5 float: 5.00 ulong: 5 long: 5 uint: 5 int:5 ushort: 5 short: 5 ubyte: 5 byte: 5 -- If the ulong and long cases are removed, the cast to uint gives 2048. Seems to be only float that has the problem - it disappears if I change it to double or real. --