www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1214] New: Using tuples to instanciate a delegate literal crashes compiler

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1214

           Summary: Using tuples to instanciate a delegate literal crashes
                    compiler
           Product: D
           Version: 1.014
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jrs7561 louisiana.edu


I'm pretty sure this should be legal,and if it's not it should definetly not
crash dmd.

The following code generates a crash with the message, "Assertion failure 0 on
line 710 in file 'glue.c'."

import std.stdio;

template Tuple(P...) {
    alias P Tuple;
}

alias Tuple!(int) where_t;
alias bool delegate(where_t) dgt;



int main(char[][] args) {
    doit((where_t j){ return(j[0] == 9); });
    return 0;
}

void doit(dgt exp) {
    for(int i = 0; i < 11; i++)
        if(exp(i))
            writefln("Success");
        else
            writefln("Failure");
}


-- 
May 05 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1214


dhasenan gmail.com changed:

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





It seems that whenever I try to make progress on my Project Which Must Not Be
Named, I find another one of these issues. In this case, in order to create a
mock object, I need to create delegates based on the ReturnType and
ParameterTypeTuple of a given function, and this prevents it.

Anyway, yes, a duplicate, though now in DMD2 it's moved to glue.c:717.

*** This bug has been marked as a duplicate of 854 ***


-- 
Sep 09 2007