I was trying to reduce an error, namely Internal error: e2ir.c 4026 and I generated another one {{{ struct Particle{ char[16] name; } class ReadSystem{ size_t[char[16]] pKindsIdx; void t(Particle p){ auto idx=p.name in pKindsIdx; // fails (Internal error: ../ztc/cod1.c 2636) } } void main(){ char[16] n; size_t[char[16]] aa; auto r=n in aa; // works } }}}
Is this the same as bug 1934?
Yes it looks like it, the line number changed (probably due to changes in the code) and I hadn't found it, but it really looks like the same issue. *** This issue has been marked as a duplicate of issue 1934 ***
This isn't the same as bug 1934, though it is clearly very closely related. My patch for 1934 doesn't fix this.
thanks for catching it...
Same cause as bug 1934. The patch I used for IndexExp::toElem() also needs to be applied to InExp::toElem(). Index: e2ir.c =================================================================== --- e2ir.c (revision 75) +++ e2ir.c (working copy) @@ -2391,6 +2391,13 @@ key->Enumbytes = key->E1->Enumbytes; assert(key->Enumbytes); } + else if (tybasic(key->Ety) == TYarray && taa->index->ty==Tsarray) + { // e2->elem() turns string literals into a TYarray, so the + // length is lost. Restore it. + key = el_una(OPstrpar, TYstruct, key); + assert(e1->type->size() == taa->index->size()); + key->Enumbytes = taa->index->size(); + } Symbol *s = taa->aaGetSymbol("In", 0); keyti = taa->index->getInternalTypeInfo(NULL)->toElem(irs);
Fixed dmd 1.049 and 2.034