[Issue 4826] cannot create associative array and compiler crash
http://d.puremagic.com/issues/show_bug.cgi?id=4826 Don clugd...@yahoo.com.au changed: What|Removed |Added Keywords||diagnostic --- Comment #3 from Don clugd...@yahoo.com.au 2010-09-06 23:56:32 PDT --- Reduced test case: -- struct Struct4826 {} void bug4826(T)(T[string] value) {} void test4826() { bug4826(Struct4826()); } This is closely related to bug 3996. The patch for bug 3996 removes the segfault, leaving only a useless error message with no line number, followed by a sensible error message with line number. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4826] cannot create associative array and compiler crash
http://d.puremagic.com/issues/show_bug.cgi?id=4826 --- Comment #4 from Don clugd...@yahoo.com.au 2010-09-07 00:04:26 PDT --- Actually even with the patch for bug 3996, I found a test case which still segfaults: struct Struct4826 { } void bug4826b(T)(int[int] value) {} void test4826b() { bug4826b(Struct4826()); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4826] cannot create associative array and compiler crash
http://d.puremagic.com/issues/show_bug.cgi?id=4826 --- Comment #5 from Don clugd...@yahoo.com.au 2010-09-07 13:47:50 PDT --- The segfault should be turned into an ICE by adding an extra assert into TypeAArray::getImpl(), in mtype.c 3967. +assert(ti-inst || sc); ti-semantic(sc); ti-semantic2(sc); ti-semantic3(sc); The problem is, that the template instance needs a scope (sc), but the scope is never set, so it remains NULL, causing a segfault when it is first used. I don't know how to solve this. I'm not even sure of what the scope should be. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4826] cannot create associative array and compiler crash
http://d.puremagic.com/issues/show_bug.cgi?id=4826 --- Comment #1 from brian-sch...@cox.net 2010-09-05 19:29:53 PDT --- Here's the code that fails: The second opIndexAssign is written this way because of bug 2972. module testcase; struct SomeStruct { void opIndexAssign(T)(T[string] value, string key) if(is(T : string) || is(T : int)) { } void opIndexAssign(T)(SomeStruct value, string key) if(is(T : SomeStruct)) { } } void main(string[] args) { auto t = SomeStruct(); t[test] = [key: value, otherKey: otherValue]; auto k = SomeStruct(); t[fails] = k; // Error: cannot create associative array T[string] // Segmentation fault } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4826] cannot create associative array and compiler crash
http://d.puremagic.com/issues/show_bug.cgi?id=4826 --- Comment #2 from brian-sch...@cox.net 2010-09-05 19:34:48 PDT --- (In reply to comment #1) That should have been: void opIndexAssign(T)(T value, string key) if(is(T : SomeStruct)) { } But the error is the same either way. Bugzilla needs an edit button. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---