| ... | @@ -359,6 +359,30 @@ extern fn c_fputs([*c]const u8, noalias [*c]FILE) c_int; | ... | @@ -359,6 +359,30 @@ extern fn c_fputs([*c]const u8, noalias [*c]FILE) c_int; |
| 359 | extern fn c_ftell([*c]FILE) c_long; | 359 | extern fn c_ftell([*c]FILE) c_long; |
| 360 | extern fn c_fopen([*c]const u8, [*c]const u8) [*c]FILE; | 360 | extern fn c_fopen([*c]const u8, [*c]const u8) [*c]FILE; |
| 361 | | 361 | |
| | 362 | const exp = struct { |
| | 363 | export fn c_printf(a: [*c]const u8) c_int { |
| | 364 | _ = a; |
| | 365 | unreachable; |
| | 366 | } |
| | 367 | export fn c_fputs(a: [*c]const u8, noalias b: [*c]FILE) c_int { |
| | 368 | _ = a; |
| | 369 | _ = b; |
| | 370 | unreachable; |
| | 371 | } |
| | 372 | export fn c_ftell(a: [*c]FILE) c_long { |
| | 373 | _ = a; |
| | 374 | unreachable; |
| | 375 | } |
| | 376 | export fn c_fopen(a: [*c]const u8, b: [*c]const u8) [*c]FILE { |
| | 377 | _ = a; |
| | 378 | _ = b; |
| | 379 | unreachable; |
| | 380 | } |
| | 381 | }; |
| | 382 | comptime { |
| | 383 | _ = exp; |
| | 384 | } |
| | 385 | |
| 362 | test "Extern function calls in @TypeOf" { | 386 | test "Extern function calls in @TypeOf" { |
| 363 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 387 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 364 | | 388 | |
| ... | @@ -367,6 +391,14 @@ test "Extern function calls in @TypeOf" { | ... | @@ -367,6 +391,14 @@ test "Extern function calls in @TypeOf" { |
| 367 | | 391 | |
| 368 | extern fn s_do_thing([*c]const @This(), b: c_int) c_short; | 392 | extern fn s_do_thing([*c]const @This(), b: c_int) c_short; |
| 369 | }; | 393 | }; |
| | 394 | const E = struct { |
| | 395 | export fn s_do_thing(a: [*c]const @This(), b: c_int) c_short { |
| | 396 | _ = a; |
| | 397 | _ = b; |
| | 398 | unreachable; |
| | 399 | } |
| | 400 | }; |
| | 401 | _ = E; |
| 370 | | 402 | |
| 371 | const Test = struct { | 403 | const Test = struct { |
| 372 | fn test_fn_1(a: anytype, b: anytype) @TypeOf(c_printf("%d %s\n", a, b)) { | 404 | fn test_fn_1(a: anytype, b: anytype) @TypeOf(c_printf("%d %s\n", a, b)) { |