www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



D.gnu - [Issue 1683] New: Issue with variadic functions

↑ ↓ ← d-bugmail puremagic.com writes:
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 users.sf.net
        ReportedBy: mariusmuja 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)


-- 
Nov 21 2007
→ d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1683





------- Comment #1 from afb algonet.se  2007-11-22 01:07 -------
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)");
}


-- 
Nov 21 2007
→ d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1683


mariusmuja gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #2 from mariusmuja gmail.com  2007-11-22 02:31 -------
Yes, it does.


-- 
Nov 22 2007