Bug 8750 – ICE when using any and all as a template condition

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2012-10-03T21:22:41Z
Last change time
2018-02-10T20:08:30Z
Assigned to
No Owner
Creator
daniel

Comments

Comment #0 by daniel350 — 2012-10-03T21:22:41Z
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.
Comment #1 by daniel350 — 2012-10-03T21:38:47Z
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)
Comment #2 by hsteoh — 2014-08-10T04:44:04Z
On dmd git HEAD (2.067a), this code no longer causes an ICE, but there's a compile error: test.d(8): Error: template std.algorithm.all cannot deduce function from argument types !((x) => any!((y) => x == y)(R))(string), candidates are: /usr/src/d/phobos/std/algorithm.d(11584): std.algorithm.all(alias pred = "a")
Comment #3 by greensunny12 — 2018-02-10T20:08:30Z
Fixed in 2.064: 2.062 to 2.063 : Status -6 with output: dmd: mangle.c:100: char* mangle(Declaration*, bool): Assertion `fd && fd->inferRetType' failed. 2.064 : Failure with output: ----- onlineapp.d(9): Error: template std.algorithm.all does not match any function template declaration. Candidates are: