www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem with function taking variable number of arguments with -m64

reply tipdbmp <email example.com> writes:
//
// rdmd -m64 foo.d
//
module va_arg_x64_windows;

void foo(void* a, void* b, void *c, void* d, ...) {
     import core.vararg : va_arg;
     import std.stdio : writeln;

     foreach (arg; _arguments) {
         if (arg == typeid(int)) {
             int x = va_arg!(int)(_argptr);
             writeln("x: ", x);
         }
         //else {
         //    writeln("unknown arg type: ", arg.toString());
         //}
     }
}

void main() {
     foo(null, null, null, null, 1234, 5678);
     // expected:
     //     x: 1234
     //     x: 5678
     // output:
     //     x: 0
     //     x: 1234
}
Jan 11
parent tipdbmp <email example.com> writes:
So is this a bug, or am I misunderstanding something?
Jan 14