www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8750] New: ICE when using any and all as a template condition

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

           Summary: ICE when using any and all as a template condition
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: daniel350 bigpond.com



PDT ---
import std.stdio : writeln;
import std.algorithm : any, all, countUntil, canFind;

struct mystruct {
    int a, b;
}

int myfunc(string sw, R ...)(mystruct v) if (all!(x => any!(y => x ==
y)(R))(sw)) { // FIXME: Breaks DMD
    return mixin("v." ~ sw[0] ~ "+ v." ~ sw[1]); 
}

void main() {
    mystruct z = {3, 4};

    writeln(myfunc!("aa", 'a', 'b')(z));
}

DPaste: http://dpaste.dzfl.pl/fe062cd3

ICE: dmd: mangle.c:81: char* mangle(Declaration*): Assertion `fd &&
fd->inferRetType' failed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 03 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8750




PDT ---
The intention of the above is: all!(x => x in R)(sw).
Therefore, the clearer code (still fails) would be: all!(x => any!(x)(R))(sw)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 03 2012