changeset 25:12fd8ce55d9c trunk

[svn r29] * Fixed structs inside struct literals
author lindquist
date Thu, 04 Oct 2007 10:22:56 +0200
parents 25bb577878e8
children 99737f94abfb
files gen/toir.c test/structs5.d
diffstat 2 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gen/toir.c	Thu Oct 04 10:13:21 2007 +0200
+++ b/gen/toir.c	Thu Oct 04 10:22:56 2007 +0200
@@ -1378,7 +1378,12 @@
                 elem* ve = vx->toElem(p);
                 llvm::Value* val = ve->getValue();
                 Logger::cout() << *val << " | " << *arrptr << '\n';
-                new llvm::StoreInst(val, arrptr, p->scopebb());
+                if (vx->type->ty == Tstruct) {
+                    TypeStruct* ts = (TypeStruct*)vx->type;
+                    LLVM_DtoStructCopy(ts,arrptr,val);
+                }
+                else
+                    new llvm::StoreInst(val, arrptr, p->scopebb());
                 delete ve;
             }
             else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/structs5.d	Thu Oct 04 10:22:56 2007 +0200
@@ -0,0 +1,23 @@
+module structs5;
+
+void main()
+{
+    {S s = S();}
+    {T t = T(1);}
+    {U u = U();}
+}
+
+struct S
+{
+}
+
+struct T
+{
+    int i;
+}
+
+struct U
+{
+    S s;
+    long l;
+}