mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fixes member visibility for anonymous bitstruct. Bitstruct member attributes works. Anonymous bitstruct assignment fixed.
This commit is contained in:
24
test/test_suite/bitstruct/anon_bitstruct_name_overlap.c3
Normal file
24
test/test_suite/bitstruct/anon_bitstruct_name_overlap.c3
Normal file
@@ -0,0 +1,24 @@
|
||||
import std::io;
|
||||
|
||||
struct Test {
|
||||
ushort a;
|
||||
bitstruct : ushort @overlap {
|
||||
ushort ab : 0..15;
|
||||
char a : 8..15; // #error: Duplicate member name 'a'
|
||||
char b : 0..7;
|
||||
bool c : 7;
|
||||
bool d : 6;
|
||||
bool e : 5;
|
||||
bool f : 4;
|
||||
}
|
||||
}
|
||||
|
||||
fn void main() {
|
||||
io::printfn("Weird structs :P");
|
||||
|
||||
Test test;
|
||||
test.ab = 0xAFBA;
|
||||
|
||||
io::printfn("%02x %02x -> %04x\n", test.a, test.b, test.ab);
|
||||
io::printfn("%x %x %x %x\n", test.c, test.d, test.e, test.f);
|
||||
}
|
||||
Reference in New Issue
Block a user