From 75ff5ddcd39ed0ab5030ca7d3a9b200347b579b2 Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Thu, 20 Apr 2023 00:44:45 -0700 Subject: Visual Studio 22 does not compile va_arg that are function pointers. Instead, the function pointers must be a typdef. For what its worth, see https://stackoverflow.com/a/37114318. --- spec/ffi/fixtures/ClosureTest.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/ffi/fixtures/ClosureTest.c b/spec/ffi/fixtures/ClosureTest.c index 16f72c4..47273e8 100644 --- a/spec/ffi/fixtures/ClosureTest.c +++ b/spec/ffi/fixtures/ClosureTest.c @@ -16,10 +16,10 @@ double testClosureVrDva(double d, ...) { va_list args; - double (*closure)(void); + typedef double (*closure_fun)(void); va_start(args, d); - closure = va_arg(args, double (*)(void)); + closure_fun closure = va_arg(args, closure_fun); va_end(args); return d + closure(); @@ -27,12 +27,12 @@ double testClosureVrDva(double d, ...) { long testClosureVrILva(int i, long l, ...) { va_list args; - int (*cl1)(int); - long (*cl2)(long); + typedef int (*cl1_fun)(int); + typedef long (*cl2_fun)(long); va_start(args, l); - cl1 = va_arg(args, int (*)(int)); - cl2 = va_arg(args, long (*)(long)); + cl1_fun cl1 = va_arg(args, cl1_fun); + cl2_fun cl2 = va_arg(args, cl2_fun); va_end(args); return cl1(i) + cl2(l); -- cgit v1.2.1