Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 08, 2009 [Issue 3306] New: bad function/delegate literal generated into header files | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3306 Summary: bad function/delegate literal generated into header files Product: D Version: 2.032 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: r.sagitario@gmx.de --- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 2009-09-07 23:42:31 PDT --- While trying to compile tango with dmd 1.046, I ran into the a problem with the di-header generated for atomic.d. A reduced version that reproduces the bug in dmd 2.032 aswell is test.d: int foo(int function() fn) { return fn(); } int bar(T)() { return foo(function int (){ return 0; }); } >dmd -c -H test.d >dmd -c test.di test.di(10): found 'function' when expecting '.' following 'int' test.di(10): found '(' when expecting identifier following 'int.' test.di(11): found '{' when expecting ';' following 'return statement' test.di(14): Declaration expected, not ')' test.di(16): unrecognized declaration This is caused by a wrong function literal being generated into the di-file: // D import file generated from 'test.d' int foo(int function() fn) { return fn(); } template bar(T) { int bar() { return foo(int function() { return 0; } ); } } Note the difference "foo(int function()..." and "foo(function int ()...". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 08, 2009 [Issue 3306] bad function/delegate literal generated into header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=3306 Rainer Schuetze <r.sagitario@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, wrong-code --- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> 2009-09-07 23:46:41 PDT --- Here is the patch that fixes the problem, but I have no idea why it was implemented the way it was before. There might be other places that may need the original implementation. --- func.c (revision 196) +++ func.c (working copy) @@ -2426,15 +2426,9 @@ void FuncLiteralDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { - static Identifier *idfunc; - static Identifier *iddel; - - if (!idfunc) - idfunc = new Identifier("function", 0); - if (!iddel) - iddel = new Identifier("delegate", 0); - - type->toCBuffer(buf, ((tok == TOKdelegate) ? iddel : idfunc), hgs); + buf->writestring(kind()); + buf->writeByte(' '); + type->toCBuffer(buf, NULL, hgs); bodyToCBuffer(buf, hgs); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 05, 2010 [Issue 3306] bad function/delegate literal generated into header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=3306 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-02-04 20:34:08 PST --- Changelog 366 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 05, 2010 [Issue 3306] bad function/delegate literal generated into header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=3306 Kosmonaut <Kosmonaut@tempinbox.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Kosmonaut@tempinbox.com --- Comment #3 from Kosmonaut <Kosmonaut@tempinbox.com> 2010-02-04 22:45:39 PST --- (In reply to comment #2) > Changelog 366 http://www.dsource.org/projects/dmd/changeset/366 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 09, 2010 [Issue 3306] bad function/delegate literal generated into header files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | http://d.puremagic.com/issues/show_bug.cgi?id=3306 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-03-08 22:19:39 PST --- Fixed dmd 1.057 and 2.041 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation