Permalink
Browse files

-Added test case for bug 9495

-Using Target::ptrsize instead of hardcoded constant
  • Loading branch information...
1 parent 019ae77 commit 43bcad18862f8698bb2b527f2c23f7ffb6bc98b8 @Ingrater Ingrater committed Feb 22, 2013
Showing with 30 additions and 1 deletion.
  1. +1 −1 src/func.c
  2. +29 −0 test/runnable/test9495.d
View
2 src/func.c
@@ -1501,7 +1501,7 @@ void FuncDeclaration::semantic3(Scope *sc)
p = v_arguments; // last parameter is _arguments[]
if (global.params.is64bit && global.params.isWindows)
{ offset += Target::ptrsize;
- if (p->storage_class & STClazy || p->type->size() > 8)
+ if (p->storage_class & STClazy || p->type->size() > Target::ptrsize)
{
/* Necessary to offset the extra level of indirection the Win64
* ABI demands
View
29 test/runnable/test9495.d
@@ -0,0 +1,29 @@
+import core.vararg;
+
+int func1(int a, ...)
+{
+ auto result = va_arg!int(_argptr);
+ return result;
+}
+
+void test9495a()
+{
+ assert(func1(5, 12345678) == 12345678);
+}
+
+int func2(const(char)[] a, ...)
+{
+ auto result = va_arg!int(_argptr);
+ return result;
+}
+
+void test9495b()
+{
+ assert(func2("5", 12345678) == 12345678);
+}
+
+void main(string[] args)
+{
+ test9495a();
+ test9495b();
+}

0 comments on commit 43bcad1

Please sign in to comment.