[Issue 22307] New: importC: unable to parse __builtin_va_arg

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 14 21:18:04 UTC 2021


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

          Issue ID: 22307
           Summary: importC: unable to parse __builtin_va_arg
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dave287091 at gmail.com

Consider the following preprocessed program using varargs.

typedef __builtin_va_list va_list;
int add_nums(int count, ...)
{
    int result = 0;
    va_list args;
    __builtin_va_start(args, count);
    for (int i = 0; i < count; ++i) {
        result += __builtin_va_arg(args, int); // Error: expression expected,
not `int`
    }
    __builtin_va_end(args);
    return result;
}

__builtin_va_arg is unusual, looking like a function, but taking a type as the
second argument.

--


More information about the Digitalmars-d-bugs mailing list