Bug 1338 – cygwin/gdc compilation error for legal code (variadic templates)

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-07-12T18:44:00Z
Last change time
2015-06-09T05:15:04Z
Keywords
rejects-valid
Assigned to
dvdfrdmn
Creator
tortoise_74

Comments

Comment #0 by tortoise_74 — 2007-07-12T18:44:30Z
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
Comment #1 by casantander1 — 2007-07-13T11:18:53Z
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.
Comment #2 by clugdbug — 2008-07-03T08:43:49Z
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>