| 1 | module main |
| 2 | |
| 3 | // has `typedef` |
| 4 | @[typedef] |
| 5 | struct C.Foo1 {} |
| 6 | |
| 7 | type AliasFoo1 = C.Foo1 |
| 8 | |
| 9 | // no `typedef` |
| 10 | struct C.Foo2 {} |
| 11 | |
| 12 | type AliasFoo2 = C.Foo2 |
| 13 | |
| 14 | struct Bar {} |
| 15 | |
| 16 | type AliasBar = Bar |
| 17 | |
| 18 | fn main() { |
| 19 | // test cast `voidptr/nil` to `alias` |
| 20 | _ = AliasFoo1(unsafe { nil }) |
| 21 | _ = AliasFoo2(unsafe { nil }) |
| 22 | _ = AliasBar(unsafe { nil }) |
| 23 | |
| 24 | // test cast `voidptr/nil` to `non-alias` and has `typedef` |
| 25 | _ = C.Foo1(unsafe { nil }) |
| 26 | // test cast `voidptr/nil` to `non-alias` and no `typedef` |
| 27 | _ = C.Foo2(unsafe { nil }) |
| 28 | } |
| 29 | |