[Issue 22102] importC: Error: function is used as a type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 5 23:21:07 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22102

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject.org> ---
Similar to issue 21992.


While the rewrite could be handled by DeclarationExp semantic.  There's no way
to know that the original declaration had parenthesis around the variable name.
 e.g: If `e.declaration.type` resolves as a function declaration, how do we
know whether the original code was `fn(p);` or `fn p;`?

It's probably safer to first assume CallExp in CParser, as that's the most
common usage of the ambiguous syntax.  If `fn` is then found to be a type,
rewrite it into a DeclarationExp.

--


More information about the Digitalmars-d-bugs mailing list