Thread overview
[Issue 22102] importC: Error: function is used as a type
Jul 05, 2021
Iain Buclaw
Jul 05, 2021
Iain Buclaw
Jul 05, 2021
Iain Buclaw
Jul 07, 2021
Dlang Bot
Jul 08, 2021
Dlang Bot
July 05, 2021
https://issues.dlang.org/show_bug.cgi?id=22102

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ImportC
                 CC|                            |ibuclaw@gdcproject.org

--
July 05, 2021
https://issues.dlang.org/show_bug.cgi?id=22102

--- Comment #1 from Iain Buclaw <ibuclaw@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.

--
July 05, 2021
https://issues.dlang.org/show_bug.cgi?id=22102

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--
July 07, 2021
https://issues.dlang.org/show_bug.cgi?id=22102

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ibuclaw created dlang/dmd pull request #12834 "fix Issue 22102 - importC: Error: function is used as a type" fixing this issue:

- fix Issue 22102 - importC: Error: function is used as a type

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

--
July 08, 2021
https://issues.dlang.org/show_bug.cgi?id=22102

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12834 "fix Issue 22102 - importC: Error: function is used as a type" was merged into master:

- 56dc76a677315f9bfefeac08c46ed1bf923898d8 by Iain Buclaw:
  fix Issue 22102 - importC: Error: function is used as a type

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

--