digitalmars.D.bugs - [Issue 2368] New: Calling a function with an address of another function, then calling a returned object is rejected
- d-bugmail puremagic.com (33/33) Sep 21 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2368
- d-bugmail puremagic.com (9/9) Oct 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2368
http://d.puremagic.com/issues/show_bug.cgi?id=2368 Summary: Calling a function with an address of another function, then calling a returned object is rejected Product: D Version: 2.019 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: snake.scaly gmail.com Sorry for the long summary. In the following code, the last line of main() is rejected by the compiler: int function() wrap(void function()) { static int worker() { return 0; } return &worker; } void main() { auto x = wrap(&main)(); // OK wrap(&main)(); // found '&' when expecting ')'; no identifier for declarator wrap; etc. } This seems to have to do something with an ampersand ('&') because similar code with passing other objects works: auto m = &main; wrap(m)(); compiles correctly. --
Sep 21 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2368 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 1.036 and 2.020 --
Oct 20 2008