[Issue 7900] New: CTFE Internal error with -inline and associative arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 13 20:37:44 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7900

           Summary: CTFE Internal error with -inline and associative
                    arrays
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: brian-schott at cox.net


--- Comment #0 from brian-schott at cox.net 2012-04-13 20:38:32 PDT ---
Reduced test case created with Dustmite and a bit of hand-editing:

--------------------------------

import std.range;

class Trie(K, V)
{
    void add(K key, V val)
    {
        Trie!(K,V) current = this;
        foreach(keyPart; key)
        {
            current.children[keyPart] = new Trie!(K, V);
        }
    }
    Trie!(K,V)[ElementType!K] children;
}

string fun(string[] args ...)
{
    auto t = new Trie!(string, string);
    t.add(args[0], "");
    foreach(v; t.children)
        if (v.children.length) {}
    return "";
}

void main()
{
    mixin(fun("=", "TokenType.assign"));
}

--------------------------------

testcase.d(21): Error: CTFE internal error: illegal value ��D.children

dmd: interpret.c:6678: void VarDeclaration::setValue(Expression*): Assertion
`isCtfeValueValid(newval)' failed.
Aborted

-------------------------------

No, that garbage in the error message is not a copy-paste error. It's different
each time I try to build, which leads me to suspect that something in the
compiler was uninitialized.

Possibly related: changing line 21 to foreach(v; t.children.values) results in
this error:

dmd: interpret.c:5527: TypeAArray* toBuiltinAAType(Type*): Assertion `t->ty ==
Tstruct' failed.
Aborted

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list