Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
November 29, 2010 [Issue 5288] New: auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5288 Summary: auto return: forward ref error when using it with recursive functions Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: nfxjfg@gmail.com --- Comment #0 from nfxjfg@gmail.com 2010-11-29 03:21:53 PST --- auto x(int z) { if (z == 1) { return x(z); //line 3 } else { return z; //line 5 } } z.d(3): Error: forward reference to x z.d(5): Error: mismatched function return type inference of int and _error_ It works when you switch line 3 and 5. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 07, 2011 [Issue 5288] auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5288 nfxjfg@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 07, 2011 [Issue 5288] auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5288 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |braddr@puremagic.com Resolution|WONTFIX | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 04, 2011 [Issue 5288] auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5288 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2011-04-03 22:12:01 PDT --- This one is a little hard to fix, because the semantic analysis for function bodies goes statement by statement in a forward manner. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 04, 2011 [Issue 5288] auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5288 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #2 from bearophile_hugs@eml.cc 2011-04-04 11:54:27 PDT --- (In reply to comment #1) > This one is a little hard to fix, because the semantic analysis for function bodies goes statement by statement in a forward manner. This is a nice bug report, and to solve this kind of code the D compiler probably needs a little more powerful type inference. If you are able to do this improvement with a reasonable amount of work and code, then it's OK. Otherwise an option it to mark this with WONTFIX to keep the D compiler simpler. A better type inferencer may require more compilation time and a bigger compiler. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 25, 2011 [Issue 5288] auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5288 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Platform|Other |All OS/Version|Linux |All --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-25 11:12:06 PST --- There is mutually recursive call as a slightly more complex case. From http://d.puremagic.com/issues/show_bug.cgi?id=2810#c8 auto foo() { bar(); return 1; } auto bar() { foo(); return 1; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 03, 2011 [Issue 5288] auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5288 --- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-03 06:06:08 PST --- *** Issue 7059 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 04, 2013 [Issue 5288] auto return: forward ref error when using it with recursive functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=5288 Maksim Zholudev <maximzms@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maximzms@gmail.com --- Comment #5 from Maksim Zholudev <maximzms@gmail.com> 2013-03-04 08:57:00 PST --- Now this doesn't work even if lines 3 and 5 go in reverse order: -------------------- auto x(int z) { if (z == 1) { return z; } else { return x(z); } } void main() {} -------------------- test.d(6): Error: forward reference to x -------------------- DMD from Git head: https://github.com/D-Programming-Language/dmd/commit/13b3bdbf3819fec810ebfb077957510612dfa815 -- 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