Bug 22887 – ImportC: typedef enum fails

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-17T10:31:20Z
Last change time
2022-03-24T09:21:44Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Andrea Fontana

Comments

Comment #0 by trikkuz — 2022-03-17T10:31:20Z
See also: https://issues.dlang.org/show_bug.cgi?id=22726 This still doesn't compile: ``` typedef enum A B; ```
Comment #1 by trikkuz — 2022-03-17T10:33:06Z
(but it compiles with every compiler I tested with -std=c99 and -std=c11)
Comment #2 by b2.temp — 2022-03-17T10:41:22Z
Importance enhancement -> normal, i.e "bug". If that compiles with all C compilers and that no macro is involved then it's a bug.
Comment #3 by trikkuz — 2022-03-17T10:56:04Z
default value for importance should be "not set" :)
Comment #4 by bugzilla — 2022-03-22T06:19:51Z
gcc and clang fail to compile it with the -Wpedantic switch: "warning: ISO C forbids forward references to enum types" C11 requires enum declarations to have members.
Comment #5 by duser — 2022-03-22T16:42:38Z
here's a similar one that gcc and clang accept: enum A { a }; typedef enum A B; maybe this is what the issue submitter meant? glibc headers have two instances of this pattern with the enum defined before the typedef
Comment #6 by bugzilla — 2022-03-24T06:58:00Z
Yes, that should compile but does not.
Comment #7 by dlang-bot — 2022-03-24T07:25:30Z
@WalterBright created dlang/dmd pull request #13882 "fix Issue 22887 - ImportC: typedef enum fails" fixing this issue: - fix Issue 22887 - ImportC: typedef enum fails https://github.com/dlang/dmd/pull/13882
Comment #8 by dlang-bot — 2022-03-24T09:21:44Z
dlang/dmd pull request #13882 "fix Issue 22887 - ImportC: typedef enum fails" was merged into master: - c973fcddc4b0786c2b12c7de4754030fa422f3de by Walter Bright: fix Issue 22887 - ImportC: typedef enum fails https://github.com/dlang/dmd/pull/13882