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)
Comment #1 by afb — 2007-11-22T01:07:04Z
It works OK if you use the portable version of varargs:
import std.stdio;
import std.stdarg;
void test(TypeInfo[] arguments, va_list argptr)
{
writefln("test(TypeInfo[] arguments, va_list argptr)");
}