Comment #0 by bus_dbugzilla — 2009-01-08T01:50:41Z
-----------------
void foo(T)(T arg)
{
int i = 999;
byte b = i;
}
void main()
{
float f;
foo(f);
}
-----------------
The above code compiles correctly with warnings disabled. But when warnings are enabled, an template instantiation error is generated:
-----------------
warning - main.d(4): Error: implicit conversion of expression (i) of type int to byte can cause loss of data
main.d(10): template instance main_.foo!(float) error instantiating
-----------------
This might be related to #2567 and DMD's general treatment of warnings as errors.
Comment #1 by yebblies — 2011-06-10T06:40:33Z
In dmd 1.063 this no longer generates the error, but does cause the warning. The failed compilation is in line with dmd's treatment of errors. The -wi switch has since been introduced for the case you do not want to treat warnings as error.