[dmd-beta] dmd 1.058 and 2.043 beta

Don Clugston dclugston at googlemail.com
Wed Apr 7 20:29:57 PDT 2010


Further reduced test case:

import std.typecons;

struct V {
      void * p[1];
}

alias Tuple!(V) crash;

It seems to be related to the use of void *. (If you make V just
struct V { void *p;}  it will still crash, but it's harder to debug).



On 8 April 2010 00:32, Walter Bright <walter at digitalmars.com> wrote:
> Hmm, nothing jumps out as obviously wrong there, though it clearly has
> something to do with the .init. It should perhaps use .init[0] instead.
>
> Don Clugston wrote:
>>>>
>>>> (2) I'm working on tracking down the Phobos unittest stack overflow.
>>>> It seems to be a regression. I've cut it down to this test case:
>>>> ---
>>>> import std.variant;
>>>> import std.typecons;
>>>>
>>>> alias Tuple!(Variant) crash;
>>>> ---
>>>> There have been no relevant changes to Phobos. I'm still working on it.
>>>>
>>>
>>> It compiled in DMD svn 421, and fails in svn 423. It's caused by the
>>> ".init property for static arrays is now an array literal." change.
>>>
>>
>> Here's the problem:
>>
>> conv.d,  line 260:
>> /**
>> For structs that do not define $(D toString), the conversion to string
>> produces the list of fields.
>>  */
>> T to(T, S)(S s, in T left = S.stringof~"(", in T separator = ", ",
>>        in T right = ")")
>> if (is(S == struct) && isSomeString!(T) && !is(typeof(&S.init.toString)))
>> {
>>    Tuple!(FieldTypeTuple!(S)) * t = void;     // < ---------- Creates a
>> Tuple
>> ----------
>> and Tuple contains toString, defined in typecons.d line 435:
>>
>>    string toString()
>>    {
>>        char[] result;
>>        auto app = appender(&result);
>>        app.put(toStringHeader);
>>        foreach (i, Unused; noStrings!(T).Result)
>>        {
>>            static if (i > 0) result ~= toStringSeparator;
>>            static if (is(typeof(to!string(field[i]))))
>> <------------ this is calls to!()
>>                app.put(to!string(field[i]));
>> ------------
>>
>> And that's all I have time for. I think this should fixed before the
>> release goes out -- it's a pretty nasty regression.
>> _______________________________________________
>> dmd-beta mailing list
>> dmd-beta at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>
>>
>>
>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>


More information about the dmd-beta mailing list