[Issue 1899] AA of fixed-length arrays fails to initialize

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1899

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|2.012   |D2

--


[Issue 1899] AA of fixed-length arrays fails to initialize

2011-02-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1899


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from Don clugd...@yahoo.com.au 2011-02-06 13:49:34 PST ---
Fixed
https://github.com/D-Programming-Language/dmd/commit/fce5be52f1a7b7e4f910d8bc4ee2b632f6fc9843

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


[Issue 1899] AA of fixed-length arrays fails to initialize

2011-01-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1899


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||patch
 CC||clugd...@yahoo.com.au


--- Comment #2 from Don clugd...@yahoo.com.au 2011-01-19 13:12:10 PST ---
PATCH: AssignExp::semantic(). We mustn't convert it into a slice assignment,
because it may be a construction.
Also require an implicit conversion, so that we can allow assignment of array
literals. Quick test case:

void bug1899() 
{
int[3][string] AA;
int[3] x = [5,4,3];
AA[abc] = x;
assert(AA[abc] == x);
AA[def] = [1,2,3];
assert(AA[def]==[1,2,3]);
}

---
Index: expression.c
===
--- expression.c(revision 882)
+++ expression.c(working copy)
@@ -9086,10 +9086,23 @@
 }

 if (t1-ty == Tsarray  !refinit)
-{   // Convert e1 to e1[]
+{   
+if (e1-op == TOKindex 
+((IndexExp *)e1)-e1-type-toBasetype()-ty == Taarray)
+{
+// Assignment to an AA of fixed-length arrays.
+// Convert T[n][U] = T[] into T[n][U] = T[n]
+e2 = e2-implicitCastTo(sc, e1-type);
+if (e2-type == Type::terror)
+return e2;
+}
+else
+{
+// Convert e1 to e1[]
 Expression *e = new SliceExp(e1-loc, e1, NULL, NULL);
 e1 = e-semantic(sc);
 t1 = e1-type-toBasetype();
+}
 }

 e2-rvalue();
@@ -9131,8 +9144,13 @@
 else if (t1-ty == Tsarray)
 {
 /* Should have already converted e1 = e1[]
+ * unless it is an AA
  */
-assert(op == TOKconstruct);
+if (!(e1-op == TOKindex  t2-ty == Tsarray 
+((IndexExp *)e1)-e1-type-toBasetype()-ty == Taarray))
+{
+assert(op == TOKconstruct);
+}
 //error(cannot assign to static array %s, e1-toChars());
 }
 else if (e1-op == TOKslice)

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


[Issue 1899] AA of fixed-length arrays fails to initialize

2010-07-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1899


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||dsim...@yahoo.com


--- Comment #1 from Don clugd...@yahoo.com.au 2010-07-13 08:06:19 PDT ---
*** Issue 4343 has been marked as a duplicate of this issue. ***

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