September 22, 2008 [Issue 2368] New: Calling a function with an address of another function, then calling a returned object is rejected | ||||
---|---|---|---|---|
| ||||
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. -- |
October 21, 2008 [Issue 2368] Calling a function with an address of another function, then calling a returned object is rejected | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2368 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla@digitalmars.com 2008-10-20 22:18 ------- Fixed dmd 1.036 and 2.020 -- |
Copyright © 1999-2021 by the D Language Foundation