www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 1338] New: cygwin/gdc compilation error for legal code (variadic templates)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1338

           Summary: cygwin/gdc compilation error for legal code (variadic
                    templates)
           Product: DGCC aka GDC
           Version: 0.23
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: tortoise_74 yahoo.co.uk


The following code fails to compile under gdc on cygwin:
---
import std.stdio;

void myWritefln(T...)(T args)
{
     foreach(arg; args)
         writef("%s", arg);

     writefln();
}

void main() {
        myWritefln("Hi! ", 5, " that's all.");
}
---
F:\projects\Agenda>gdc --version
gdc (GCC) 3.4.4 (cygming special, gdc 0.23, using dmd 1.007))

F:\projects\Agenda>gdc test2.d
cc1d: warning: command line option "-iprefix" is valid for C/C++/ObjC/ObjC++
but
 not for D
test2.d:3: found '...' when expecting ')'
test2.d:3: semicolon expected following function declaration
test2.d:3: Declaration expected, not ')'
test2.d:5: no identifier for declarator args
test2.d:5: semicolon expected, not ')'
test2.d:5: Declaration expected, not ')'
test2.d:8: no identifier for declarator writefln
test2.d:9: unrecognized declaration

It works fine with dmd.

I am also informed it works with the following:
gdc (GCC) 4.1.1 20060524 (  (gdc 0.23, using 
dmd 1.007))" (Linux x64 version):

See the newsgroup discussion for context:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=8580


-- 
Jul 12 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1338






I have the feeling that you're just using an old version of the compiler. Using
the latest SVN revision (117) on Mac OS X, your example works fine. Try
downloading some updated binaries or building GDC from source and see what
happens.


-- 
Jul 13 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1338


clugdbug yahoo.com.au changed:

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





This definitely works in gdc-win 0.24.
==========
C:\Sandbox\test>gdc --version
gdc (GCC) 3.4.5 (mingw special) (gdc 0.24, using dmd 1.020)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Sandbox\test>gdc test.d

C:\Sandbox\test>a
Hi! 5 that's all.

C:\Sandbox\test>


-- 
Jul 03 2008