Thread overview
[Issue 2700] New: typeof tests stops compilation abruptly
Mar 01, 2009
d-bugmail
Mar 29, 2009
d-bugmail
Mar 29, 2009
d-bugmail
Apr 01, 2009
d-bugmail
March 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2700

           Summary: typeof tests stops compilation abruptly
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: andrei@metalanguage.com


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.)


-- 

March 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2700





------- Comment #1 from unknown@simplemachines.org  2009-03-29 00:19 -------
Created an attachment (id=297)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=297&action=view)
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]


-- 

March 29, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2700





------- Comment #2 from bugzilla@digitalmars.com  2009-03-29 16:18 -------
Already been fixed!


-- 

April 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2700


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #3 from bugzilla@digitalmars.com  2009-04-01 13:53 -------
Fixed DMD 2.027


--