[Issue 2392] New: Parsing ambiguity between function pointer declaration and function call
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 4 13:34:18 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2392
Summary: Parsing ambiguity between function pointer declaration
and function call
Product: D
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: minor
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: bugzilla at digitalmars.com
The following code won't compile:
int function() foo(int i);
int* p;
void main() {
foo(*p)();
}
because foo(*p)() looks like a C-style declaration of p being a pointer to a
function that returns type foo. Too work around, add parentheses:
(foo(*p)());
I can't see any way to fix this without dispensing with C style function
pointer declarations.
--
More information about the Digitalmars-d-bugs
mailing list