[Issue 1683] New: Issue with variadic functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 21 13:34:22 PST 2007


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

           Summary: Issue with variadic functions
           Product: DGCC aka GDC
           Version: 0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: mariusmuja at gmail.com


GDC fails to compile the following code:

--------------
import std.stdio;
void test(TypeInfo[] arguments, void* argptr)
{
    writefln("test(TypeInfo[] arguments, void* argptr)");
}

void test(...)
{
    writefln("test(..)");
}

void test2(...)
{
    test(_arguments, _argptr);
}

void main()
{
    test2(1,2,3);
}
--------------

with the error message:

--------------
test_args.d:15: function test_args.test called with argument types:
        (TypeInfo[],char*)
matches both:
        test_args.test(TypeInfo[],void*)
and:
        test_args.test(...)
----------------

With DMD the above code compiles and the test_args.test(TypeInfo[],void*)
function is called.

This issue prevents the usage under GDC of several functions from the tango
library, such as:
Layout(T).sprint (T[] result, T[] formatStr, ...) and 
Layout(T).sprint (T[] result, T[] formatStr, TypeInfo[] arguments, ArgList
args)


-- 



More information about the D.gnu mailing list