| ... | ... | @@ -3607,6 +3607,30 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3607 | 3607 | \\pub extern fn deref(arg_s: ?*struct_my_struct) void; |
| 3608 | 3608 | }); |
| 3609 | 3609 | |
| 3610 | cases.add("Demote function that dereference types that contain opaque type", |
| 3611 | \\struct inner { |
| 3612 | \\ _Atomic int a; |
| 3613 | \\}; |
| 3614 | \\struct outer { |
| 3615 | \\ int thing; |
| 3616 | \\ struct inner sub_struct; |
| 3617 | \\}; |
| 3618 | \\void deref(struct outer *s) { |
| 3619 | \\ *s; |
| 3620 | \\} |
| 3621 | , &[_][]const u8{ |
| 3622 | \\pub const struct_inner = opaque {}; |
| 3623 | , |
| 3624 | \\pub const struct_outer = extern struct { |
| 3625 | \\ thing: c_int, |
| 3626 | \\ sub_struct: struct_inner, |
| 3627 | \\}; |
| 3628 | , |
| 3629 | \\warning: unable to translate function, demoted to extern |
| 3630 | , |
| 3631 | \\pub extern fn deref(arg_s: ?*struct_outer) void; |
| 3632 | }); |
| 3633 | |
| 3610 | 3634 | cases.add("Function prototype declared within function", |
| 3611 | 3635 | \\int foo(void) { |
| 3612 | 3636 | \\ extern int bar(int, int); |