diff gen/tocall.cpp @ 939:cac9895be400

Automated merge with http://hg.dsource.org/projects/ldc
author Christian Kamm <kamm incasoftware de>
date Wed, 04 Feb 2009 18:39:39 +0100
parents d3a6f1a96731 a904cc9bc064
children 03d7c4aac654
line wrap: on
line diff
--- a/gen/tocall.cpp	Wed Feb 04 16:02:05 2009 +0100
+++ b/gen/tocall.cpp	Wed Feb 04 18:39:39 2009 +0100
@@ -373,15 +373,16 @@
             DValue* argval = DtoArgument(fnarg, (Expression*)arguments->data[i]);
             LLValue* arg = argval->getRVal();
 
+            int j = tf->reverseParams ? beg + n - i - 1 : beg + i;
+
             // if it's a struct inreg arg, load first to pass as first-class value
             if (tf->structInregArg && i == (tf->reverseParams ? n - 1 : 0))
             {
-                assert(fnarg->llvmAttrs & llvm::Attribute::InReg);
+                assert((fnarg->llvmAttrs & llvm::Attribute::InReg) && isaStruct(tf->structInregArg));
+                arg = DtoBitCast(arg, getPtrToType(callableTy->getParamType(j)));
                 arg = DtoLoad(arg);
             }
 
-            int j = tf->reverseParams ? beg + n - i - 1 : beg + i;
-
             // parameter type mismatch, this is hard to get rid of
             if (arg->getType() != callableTy->getParamType(j))
             {