Thread overview
[dmd-internals] Delete 4 lines, fix 8 ICE bugs...
Nov 03, 2010
Don Clugston
Nov 07, 2010
Walter Bright
November 03, 2010
According to TDPL, const T[] is supposed to mean const(const(T)[]).
But currently, it isn't; it's const(mutable(T)[])
I've added a patch to bug 4434. The patch is very simple (just delete 4 lines).
This fixes *at least* the following bugs:

4366 ICE(mtype.c) constrained template pure function with
array/pointer parameter
4434 ICE(mtype.c, 887) alias with const, shared, or immutable
4709 ICE(mtype.c): undefined variable in const struct
4743 ICE(mtype.c) involving "in UnknownType*"
4830 Regression(2.038) ICE mtype.c:879: void Type::check(): Assertion
`tn->mod == 4' failed
4871 ICE(mtype.c 875) const alias
4964 ICE(mtype.c) casting to undefined types
4980 ICE(mtype.c) on unknown type in a shared class/struct

There were also several other reported bugs which were duplicates of some of these. There may be more...

A closely related bug which requires its own one-line patch is this one: 4254 ICE(mtype.c): function with const inout parameter

and this is another one-liner (though it needs a trivial spec change as well).
5120 ICE(mtype.c) void associative arrays
November 03, 2010
----- Original Message ----

> From: Don Clugston <dclugston at googlemail.com>
> 
> According to TDPL, const T[] is supposed to mean const(const(T)[]).
> But  currently, it isn't; it's const(mutable(T)[])
> I've added a patch to bug 4434.  The patch is very simple (just delete 4
>lines).

Wait, so when you say const(mutable(T)[]), you mean head-const?  That is, the pointer and length are const, but the data can be changed?

Because when you say const(...), ... is supposed to be transitive const.  The terminology you are using is confusing to me.

Obviously your patch is good, since it fixes the bugs, but I'm not sure I understand the explanation.

-Steve




November 07, 2010
Done. (and Thanks, Don!)

Don Clugston wrote:
> According to TDPL, const T[] is supposed to mean const(const(T)[]).
> But currently, it isn't; it's const(mutable(T)[])
> I've added a patch to bug 4434. The patch is very simple (just delete 4 lines).
> This fixes *at least* the following bugs:
>
> 4366 ICE(mtype.c) constrained template pure function with
> array/pointer parameter
> 4434 ICE(mtype.c, 887) alias with const, shared, or immutable
> 4709 ICE(mtype.c): undefined variable in const struct
> 4743 ICE(mtype.c) involving "in UnknownType*"
> 4830 Regression(2.038) ICE mtype.c:879: void Type::check(): Assertion
> `tn->mod == 4' failed
> 4871 ICE(mtype.c 875) const alias
> 4964 ICE(mtype.c) casting to undefined types
> 4980 ICE(mtype.c) on unknown type in a shared class/struct
>
> There were also several other reported bugs which were duplicates of some of these. There may be more...
>
> A closely related bug which requires its own one-line patch is this one: 4254 ICE(mtype.c): function with const inout parameter
>
> and this is another one-liner (though it needs a trivial spec change as well).
> 5120 ICE(mtype.c) void associative arrays
>
>