Commit 892566f
authored
Handle explicit cast of union member (#210)
Union members are translated using accessors:
```cpp
union u { int a; }
*(char *)&u.a = 0xFF;
```
becomes
```rs
struct u { __bytes: Value<Box<[u8]>> }
impl u { pub fn a() -> Ptr<i32> { ... } } // the accessor
u.a().reinterpret_cast<u8>().write(0xFF) // Before this PR it did not compile: (u.a() as Ptr<u8>).write(0xFF)
```
This PR replaces the wrong `(u.a() as Ptr<u8>)` pattern with
`u.a().reinterpret_cast<u8>()`1 parent 36a7785 commit 892566f
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1313 | 1313 | | |
1314 | 1314 | | |
1315 | 1315 | | |
1316 | | - | |
| 1316 | + | |
1317 | 1317 | | |
1318 | | - | |
| 1318 | + | |
1319 | 1319 | | |
1320 | 1320 | | |
1321 | 1321 | | |
| |||
0 commit comments