# HG changeset patch # User lindquist # Date 1192802706 -7200 # Node ID ea65e12b0dd08b8c1dce5a09fc2c85c95fe59f7a # Parent eb7bf7b7972e9f72c29b8d124280b4c5cf1b22e4 [svn r48] fixed some storage problems diff -r eb7bf7b7972e -r ea65e12b0dd0 gen/toir.c --- 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(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; idim; 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()); } diff -r eb7bf7b7972e -r ea65e12b0dd0 test/bug17.d --- /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; +}