[Issue 15817] ICE (with no stacktrace) instead of 'cannot index null array counts' with CTFE AA
https://issues.dlang.org/show_bug.cgi?id=15817 Timothee Cour changed: What|Removed |Added CC||timothee.co...@gmail.com --- Comment #1 from Timothee Cour --- update: the problem is the count[a]++; workaround without -version=v_ICE below: // https://issues.dlang.org/show_bug.cgi?id=15817 module bugs.bug_D20160320T235820; import std.string; import std.array; int fun(string b){ auto targets=b.split.array; uint[string]counts; foreach(a;targets){ version(v_ICE){ counts[a]++; } else{ auto ptr=a in counts; if(ptr) *ptr=*ptr+1; else counts[a]=1; } } return 0; } void fun2(){ enum a=`a1.a2 b1.b2`; static int b=fun(a); } --
[Issue 15817] ICE (with no stacktrace) instead of 'cannot index null array counts' with CTFE AA
https://issues.dlang.org/show_bug.cgi?id=15817 Kenji Hara changed: What|Removed |Added Keywords||CTFE, ice Hardware|x86 |All OS|Mac OS X|All --- Comment #2 from Kenji Hara --- Dustmited test case: S[] split(S)(S s) { size_t istart; S[] result; foreach (i, c ; s) result ~= s[istart .. i]; return result; } int fun(string b) { auto targets = b.split; uint[string] counts; foreach (a; targets) counts[a]++; return 0; } void fun2() { enum a = `a1`; static b = fun(a); } --