mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-08 20:06:03 +03:00
[svn r48] fixed some storage problems
This commit is contained in:
parent
7a9434e3b6
commit
b008e187bb
2 changed files with 22 additions and 3 deletions
12
gen/toir.c
12
gen/toir.c
|
@ -1027,9 +1027,11 @@ elem* CallExp::toElem(IRState* p)
|
|||
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 @@ elem* CallExp::toElem(IRState* p)
|
|||
e->type = elem::VAL;
|
||||
}
|
||||
|
||||
Logger::println("this arguments");
|
||||
|
||||
// this arguments
|
||||
if (fn->arg) {
|
||||
Logger::println("This Call");
|
||||
|
@ -1071,6 +1075,8 @@ elem* CallExp::toElem(IRState* p)
|
|||
++argiter;
|
||||
}
|
||||
|
||||
Logger::println("regular arguments");
|
||||
|
||||
// regular arguments
|
||||
for (int i=0; i<arguments->dim; i++,j++)
|
||||
{
|
||||
|
@ -1471,7 +1477,7 @@ elem* StructLiteralExp::toElem(IRState* p)
|
|||
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 @@ elem* ArrayLiteralExp::toElem(IRState* p)
|
|||
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());
|
||||
}
|
||||
|
|
13
test/bug17.d
Normal file
13
test/bug17.d
Normal file
|
@ -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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue