bool endsWith(A1, A2)(A1 longer, A2 shorter)
{
static if (is(typeof(longer[0 .. 0] == shorter)))
{
}
else
{
}
return false;
}
void main()
{
char[] a;
byte[] b;
endsWith(a, b);
}
Attempting to compile yields:
Error: array equality comparison type mismatch, char[] vs byte[]
There is no line number, which makes the bug particularly jarring (IMHO: if a compilation error comes with no line number that can be used in tracking the error, that bug should be automatically considered major.)
Comment #1 by bugs-d — 2009-03-29T00:19:07Z
Created attachment 297
Pass loc to error().
The issue was simple actually; an unattached function was calling error() with no loc param.
This patch adds the loc param. When the error message is supposed to be shown, the location will now be (properly) added. There are other situations when this message is shown (afaict.)
Please note: because of the semantics of is(), the error message showing at all WAS an error. Since the is expression would've generated an error (which is not printed), it means it should return false. So, with this patch, the code compiles fine (rejects-valid.)
-[Unknown]