[Issue 23717] New: runnable/bitfields.c:192:5: error: unknown type name ‘S’; use ‘struct’ keyword to refer to the type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 15 17:36:02 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23717
Issue ID: 23717
Summary: runnable/bitfields.c:192:5: error: unknown type name
‘S’; use ‘struct’ keyword to refer to the type
Product: D
Version: D2
Hardware: All
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
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;
}
```
--
More information about the Digitalmars-d-bugs
mailing list