Bug 1683 – Issue with variadic functions

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-11-21T15:34:00Z
Last change time
2015-06-09T05:15:22Z
Assigned to
dvdfrdmn
Creator
mariusmuja

Comments

Comment #0 by mariusmuja — 2007-11-21T15:34:21Z
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)"); }
Comment #2 by mariusmuja — 2007-11-22T02:31:17Z
Yes, it does.