[Issue 937] New: C-style variadic functions broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 7 08:15:35 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=937

           Summary: C-style variadic functions broken
           Product: D
           Version: 1.005
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: tomas at famolsen.dk


The code below should explain the problem sufficiently:
-------------------------------------------------------


module vararg;

// Works
void a(...)
{
    void* v = _argptr;
}

// Works
void b(char* fmt, ...)
{
    void* v = _argptr;
}

// Error: variadic functions with non-D linkage must have at least one
parameter
// which is correct
extern(C)
void c(...)
{
    void* v = _argptr;
}

// Error: undefined identifier _argptr
// vararg.d(22): Error: cannot implicitly convert expression (_argptr) of type
int to void*
// this is contrary to spec!
extern(C)
void d(char* fmt, ...)
{
    void* v = _argptr;
}

void main()
{
    a("a", 2, 3.0);
    b("b", 2, 3.0);
    c("c", 3, 3.0);
    d("c", 3, 3.0);
}


-- 



More information about the Digitalmars-d-bugs mailing list