http://d.puremagic.com/issues/show_bug.cgi?id=4434
Don <clugd...@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #4 from Don <clugd...@yahoo.com.au> 2010-11-03 05:21:34 PDT --- According to TDPL, const T[] is supposed to mean const(const(T)[]). But currently, it isn't; it's const(mutable(T)[]) This happens because mtype.c, TypeNext::makeConst() includes a line which should be deleted: if (ty != Tfunction && ty != Tdelegate && - (next->deco || next->ty == Tfunction) && !next->isImmutable() && !next->isConst()) { if (next->isShared()) t->next = next->sharedConstOf(); else t->next = next->constOf(); } which means that it's not making the array contents const. Same change also needs to be applied to TypeNext::makeShared(), makeSharedConst(), makeInvariant() and possibly also to makeWild(). Test cases: ----- struct Bug4434 {} alias const Bug4434* IceConst4434; alias shared Bug4434* IceShared4434; alias shared Bug4434[] IceSharedArray4434; alias immutable Bug4434* IceImmutable4434; alias shared const Bug4434* IceSharedConst4434; alias int MyInt4434; alias const MyInt4434[3] IceConstInt4434; alias immutable string[] Bug4830; --- This patch also fixes these bugs: Bug 4366 ICE(mtype.c) constrained template pure function with array/pointer parameter Bug 4709 ICE(mtype.c): undefined variable in const struct Bug 4743 ICE(mtype.c) involving "in UnknownType*" Bug 4830 Regression(2.038) ICE mtype.c:879: void Type::check(): Assertion `tn->mod == 4' failed Bug 4871 ICE(mtype.c 875) const alias Bug 4964 ICE(mtype.c) casting to undefined types Bug 4980 ICE(mtype.c) on unknown type in a shared class/struct -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------