changeset 44:ea65e12b0dd0 trunk

[svn r48] fixed some storage problems
author lindquist
date Fri, 19 Oct 2007 16:05:06 +0200
parents eb7bf7b7972e
children ff359b65fa62
files gen/toir.c test/bug17.d
diffstat 2 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gen/toir.c	Fri Oct 19 15:26:09 2007 +0200
+++ b/gen/toir.c	Fri Oct 19 16:05:06 2007 +0200
@@ -1027,9 +1027,11 @@
     llvm::FunctionType::param_iterator argiter = llfnty->param_begin();
     int j = 0;
 
+    Logger::println("hidden struct return");
+
     // hidden struct return arguments
     if (retinptr) {
-        if (!p->lvals.empty()) {
+        if (!p->lvals.empty() && p->toplval()) {
             assert(llvm::isa<llvm::StructType>(p->toplval()->getType()->getContainedType(0)));
             llargs[j] = p->toplval();
             if (LLVM_DtoIsPassedByRef(tf->next)) {
@@ -1049,6 +1051,8 @@
         e->type = elem::VAL;
     }
 
+    Logger::println("this arguments");
+
     // this arguments
     if (fn->arg) {
         Logger::println("This Call");
@@ -1071,6 +1075,8 @@
         ++argiter;
     }
 
+    Logger::println("regular arguments");
+
     // regular arguments
     for (int i=0; i<arguments->dim; i++,j++)
     {
@@ -1471,7 +1477,7 @@
     llvm::Value* sptr = 0;
 
     // if there is no lval, this is probably a temporary struct literal. correct?
-    if (p->lvals.empty())
+    if (p->lvals.empty() || !p->toplval())
     {
         sptr = new llvm::AllocaInst(LLVM_DtoType(type),"tmpstructliteral",p->topallocapoint());
         e->mem = sptr;
@@ -2514,7 +2520,7 @@
     Logger::cout() << "array literal has llvm type: " << *t << '\n';
 
     llvm::Value* mem = 0;
-    if (p->lvals.empty()) {
+    if (p->lvals.empty() || !p->toplval()) {
         assert(LLVM_DtoDType(type)->ty == Tsarray);
         mem = new llvm::AllocaInst(t,"tmparrayliteral",p->topallocapoint());
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug17.d	Fri Oct 19 16:05:06 2007 +0200
@@ -0,0 +1,13 @@
+module bug17;
+
+struct Vec
+{
+    Vec opAdd(ref Vec b) { return Vec(); }
+    Vec opMul(double a) { return Vec(); }
+}
+void main()
+{
+    Vec foo;
+    Vec bar;
+    auto whee=foo+bar*1f;
+}