[Issue 24455] [ImportC] va_arg fails in working C code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 27 17:21:52 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24455

--- Comment #1 from Lance Bachmeier <lance at lancebachmeier.com> ---
Here's a simpler program that shows the bug. Compiles with gcc but not dmd:

#include <stdarg.h>
#include <stddef.h>

void foo(double * pm, ...) {
        va_list ap;
        double * targ;
  va_start(ap, pm);
  for (int i=1; ; i++) {
                va_arg(ap, int);
    targ = va_arg(ap, double*);
    if (targ == NULL) {
                        break;
    }
        }
  va_end(ap);
}

DMD output: va.c(9): Error: template `va_arg` is not callable using argument
types `!(int)(__va_list_tag*)`
#defines(110):        Candidate is: `va_arg(__MP23, __MP24)(__MP23 v, __MP24
l)`
va.c(10): Error: template `va_arg` is not callable using argument types
`!(double*)(__va_list_tag*)`
#defines(110):        Candidate is: `va_arg(__MP23, __MP24)(__MP23 v, __MP24
l)`

--


More information about the Digitalmars-d-bugs mailing list