Thread overview
[Issue 21976] importC: does not distinguish between cast-expression and unary-expression correctly
[Issue 21976] importC: enumeration constants rejects conditional expressions in parentheses
May 25, 2021
Iain Buclaw
May 25, 2021
Iain Buclaw
Jun 03, 2021
Walter Bright
Jun 03, 2021
Iain Buclaw
Jun 03, 2021
Dlang Bot
Jun 03, 2021
Dlang Bot
May 25, 2021
https://issues.dlang.org/show_bug.cgi?id=21976

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--
May 25, 2021
https://issues.dlang.org/show_bug.cgi?id=21976

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Likewise, this fails to compile:
---
enum constant_expression
{
  ce_first,
  ce_second = (int) ((1UL << (ce_first)) << 24),
};

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

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
            Summary|importC: enumeration        |importC: does not
                   |constants rejects           |distinguish between
                   |conditional expressions in  |cast-expression and
                   |parentheses                 |unary-expression correctly

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

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
This is the full example from `wctype.h`.

---
enum
{
  __ISwupper = 0,
  _ISwupper = ((__ISwupper) < 8
    ? (int) ((1UL << (__ISwupper)) << 24)
    : ((__ISwupper) < 16
        ? (int) ((1UL << (__ISwupper)) << 8)
        : ((__ISwupper) < 24
            ? (int) ((1UL << (__ISwupper)) >> 8)
            : (int) ((1UL << (__ISwupper)) >> 24)))),
};
---

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

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

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

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright updated dlang/dmd pull request #12627 "fix Issue 21976 - importC: does not distinguish between cast-expression and unary-expression correctly" fixing this issue:

- fix Issue 21976 ImportC: does not distinguish between cast-expression and unary-expression correctly

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

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

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

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

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12627 "fix Issue 21976 - importC: does not distinguish between cast-expression and unary-expression correctly" was merged into master:

- 36d2635f2212cba91c737a87710602e800f25e5e by Walter Bright:
  fix Issue 21976 ImportC: does not distinguish between cast-expression and
unary-expression correctly

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

--