| 1 | /// This implementation is intentionally incorrect so we can check that it is |
| 2 | /// called instead of the libc symbol. |
| 3 | export fn isdigit(c: c_int) c_int { |
| 4 | return @intFromBool(c == '0'); |
| 5 | } |
| 6 | |
| 7 | pub fn main() void { |
| 8 | const static = struct { |
| 9 | extern fn isdigit(c_int) c_int; |
| 10 | }; |
| 11 | if (static.isdigit('0') == 0) @panic("override failed: isdigit('0') == 0"); |
| 12 | if (static.isdigit('1') != 0) @panic("override failed: isdigit('1') != 0"); |
| 13 | } |
| 14 | |
| 15 | // run |
| 16 | // target=x86_64-linux-gnu,x86_64-linux-musl |
| 17 | // backend=selfhosted,llvm |
| 18 | // link_libc=true |