Bug 23717 – runnable/bitfields.c:192:5: error: unknown type name S; use struct keyword to refer to the type

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2023-02-15T17:36:02Z
Last change time
2023-02-20T12:33:55Z
Keywords
accepts-invalid, ImportC, pull
Assigned to
No Owner
Creator
Iain Buclaw
Depends on
23689
See also
https://issues.dlang.org/show_bug.cgi?id=23689

Comments

Comment #0 by ibuclaw — 2023-02-15T17:36:02Z
When compiling the test with `gcc -std=c11 -fsyntax-only` runnable/bitfields.c: In function ‘boo6’: runnable/bitfields.c:192:5: error: unknown type name ‘S’; use ‘struct’ keyword to refer to the type 192 | S s; | ^ | struct runnable/bitfields.c:193:6: error: request for member ‘a’ in something not a structure or union 193 | s.a = 3; | ^ runnable/bitfields.c:194:6: error: request for member ‘b’ in something not a structure or union 194 | s.b = 1; | ^ runnable/bitfields.c:195:6: error: request for member ‘a’ in something not a structure or union 195 | s.a += 2; | ^ runnable/bitfields.c:196:13: error: request for member ‘a’ in something not a structure or union 196 | return s.a; | ^ Test case: ``` struct S6 { unsigned int a:2, b:2; }; int boo6() { S s; s.a = 3; s.b = 1; s.a += 2; return s.a; } ```
Comment #1 by dlang-bot — 2023-02-20T07:27:04Z
@WalterBright created dlang/dmd pull request #14899 "fix Issue 23717 - runnable/bitfields.c:192:5: error: unknown type nam…" fixing this issue: - fix Issue 23717 - runnable/bitfields.c:192:5: error: unknown type name S; use struct keyword to refer to the typ https://github.com/dlang/dmd/pull/14899
Comment #2 by dlang-bot — 2023-02-20T12:33:55Z
dlang/dmd pull request #14899 "fix Issue 23717 - runnable/bitfields.c:192:5: error: unknown type nam…" was merged into master: - 3d3f11e2cbbb9047e145197ec8dd70798ad993b7 by Walter Bright: fix Issue 23717 - runnable/bitfields.c:192:5: error: unknown type name S; use struct keyword to refer to the typ https://github.com/dlang/dmd/pull/14899