Bug 2700 – typeof tests stops compilation abruptly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-03-01T17:14:00Z
Last change time
2015-06-09T05:15:21Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
andrei

Attachments

IDFilenameSummaryContent-TypeSize
2972700_use-loc.diffPass loc to error().text/plain501

Comments

Comment #0 by andrei — 2009-03-01T17:14:02Z
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]
Comment #2 by bugzilla — 2009-03-29T16:18:31Z
Already been fixed!
Comment #3 by bugzilla — 2009-04-01T13:53:48Z
Fixed DMD 2.027