When dmd is passed the "-w" tag, it "treats warnings as errors" but not with the "__traits(compiles)" expression. Is this the intended action?
This code should compile even with "-w", but it does not.
int i;
static if (__traits(compiles,i += 5.2))
i += 5.2;
pragma(msg, __traits(compiles,i += 5.2))
is true
, even though it will stop the compiler.
My specific use case, where I am hindered by this, is with a guarded template function akin to this:
void fun(T,U)(ref T a, const U b)
if (__traits(compiles, a += b))
{
a += b;
}
I think this is a bug. The Docs for __traits compiles state "Returns a bool true if all of the arguments compile . . ." which is not holding true.