D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 22912 - importC: syntax error for function call with cast and typedef and parentheses around name
Summary: importC: syntax error for function call with cast and typedef and parentheses...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: ImportC, pull
Depends on:
Blocks:
 
Reported: 2022-03-23 06:55 UTC by Walter Bright
Modified: 2022-03-23 09:19 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2022-03-23 06:55:20 UTC
typedef long my_long;
int fn1() { return 0; }
void fn2() { long x = (my_long) (fn1) (); }

Error: function expected before `()`, not `cast(long)& fn1` of type `long`
Comment 1 Walter Bright 2022-03-23 06:58:24 UTC
Replacing `my_long` with `long` works:

  void fn2() { long x = (long) (fn1) (); }
Comment 2 Dlang Bot 2022-03-23 07:25:51 UTC
@WalterBright created dlang/dmd pull request #13872 "fix Issue 22912 - importC: syntax error for function call with cast a…" fixing this issue:

- fix Issue 22912 - importC: syntax error for function call with cast and typedef and parentheses around name

https://github.com/dlang/dmd/pull/13872
Comment 3 Dlang Bot 2022-03-23 09:19:48 UTC
dlang/dmd pull request #13872 "fix Issue 22912 - importC: syntax error for function call with cast a…" was merged into master:

- a36c45ed8fe865386729cd52ca080760678f93bc by Walter Bright:
  fix Issue 22912 - importC: syntax error for function call with cast and typedef and parentheses around name

https://github.com/dlang/dmd/pull/13872