Thread overview
[Issue 22030] importC: Wrong error with bad declarator
Jun 16, 2021
Iain Buclaw
Jun 16, 2021
Iain Buclaw
Jun 16, 2021
Dlang Bot
Jun 17, 2021
Dlang Bot
June 16, 2021
https://issues.dlang.org/show_bug.cgi?id=22030

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
A further example:
---
int , int;
---

When compiled with GCC:
---
test.c:1: error: expected identifier or ‘(’ before ‘,’ token
---

However DMD compiles with no errors.  So DMD is not respecting the grammar in C11 6.7 (and in particular 6.7.6), which says that `int;` is valid (declaration-specifier without an init-declarator-list), but `int,` is not.

declaration:
    declaration-specifiers init-declarator-list(opt);

init-declarator-list:
    init-declarator
    init-declarator-list , init-declarator

init-declarator:
    declarator
    declarator = initializer

declarator:
    pointer(opt) direct-declarator

direct-declarator:
    identifier attribute-specifier-sequence(opt)
    ( declarator ) array-declarator attribute-specifier-sequence(opt)
    function-declarator attribute-specifier-sequence(opt)

--
June 16, 2021
https://issues.dlang.org/show_bug.cgi?id=22030

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |diagnostic, ImportC

--
June 16, 2021
https://issues.dlang.org/show_bug.cgi?id=22030

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 #12691 "fix Issue 22030 - importC: Wrong error with bad declarator" fixing this issue:

- fix Issue 22030 - importC: Wrong error with bad declarator

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

--
June 17, 2021
https://issues.dlang.org/show_bug.cgi?id=22030

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 #12691 "fix Issue 22030 - importC: Wrong error with bad declarator" was merged into master:

- 8605dce0a2d21e5b4358925a8d2786d249a2486a by Iain Buclaw:
  fix Issue 22030 - importC: Wrong error with bad declarator

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

--