Bug 24071 – When enum has typedef integer constants do not have types determined correctly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2023-08-05T09:37:52Z
Last change time
2023-09-12T08:54:12Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Richard Cattermole

Attachments

IDFilenameSummaryContent-TypeSize
1884wingdi.hwingdi.h for 10.0.20348.0text/plain239726

Comments

Comment #0 by alphaglosined — 2023-08-05T09:37:52Z
From wingdi.h: ```c typedef enum { DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SVIDEO = 1, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL = 0x80000000, } DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY; ``` Remove typedef and it works. Some of the output: ``` C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\wingdi.h(2804,61): Error: integer constant expression expected instead of `cast(uint)-1` C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\wingdi.h(2805,61): Error: integer constant expression expected instead of `cast(uint)0` ```
Comment #1 by dkorpel — 2023-08-08T11:40:16Z
Is the snippet alone supposed to reproduce it? I don't get the error, and I'm not on Windows so I don't have the entire file.
Comment #2 by alphaglosined — 2023-08-08T11:44:24Z
Created attachment 1884 wingdi.h for 10.0.20348.0 It was enough to produce the error on my machine. Took me quite a while to minify it down to this. I've included my copy of wingdi.h here however in case it is of interest.
Comment #3 by dlang-bot — 2023-09-12T06:39:47Z
@WalterBright created dlang/dmd pull request #15602 "fix Issue 24071 - When enum has typedef integer constants do not have…" fixing this issue: - fix Issue 24071 - When enum has typedef integer constants do not have types determined correctly https://github.com/dlang/dmd/pull/15602
Comment #4 by dlang-bot — 2023-09-12T08:54:12Z
dlang/dmd pull request #15602 "fix Issue 24071 - When enum has typedef integer constants do not have…" was merged into master: - 9e8feb39c2d3c83be76a45dc94d82194ec7bb941 by Walter Bright: fix Issue 24071 - When enum has typedef integer constants do not have types determined correctly https://github.com/dlang/dmd/pull/15602