Zig Version
0.16.0 and 0.17.0-dev.607+456b2ec07
Steps to Reproduce, Observed Behavior, and Expected Behavior
// func-print.zigconststd=@import("std");fnfoo()void{}pubfnmain()void{std.debug.print("foo: {}",.{foo});}
I ran this through 4 different versions of the compiler:
> zig env | grep target
.target = "x86_64-linux.6.12.68...6.12.68-gnu.2.42",
> zig version && zig build-exe func-print.zig
0.14.1
/home/pancelor/.local/app/zig/0.14.1/lib/std/fmt.zig:702:19: error: unable to format function body type, use '*const fn () void' for a function pointer type
.@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
> zig version && zig build-exe func-print.zig
0.15.2
/home/pancelor/.local/app/zig/0.15.2/lib/std/Io/Writer.zig:1383:19: error: unable to format function body type, use '*const fn () void' for a function pointer type
.@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
> zig version && zig build-exe func-print.zig
0.16.0
zsh: segmentation fault (core dumped) zig build-exe func-print.zig
> zig version && zig build-exe func-print.zig
0.17.0-dev.607+456b2ec07
zsh: segmentation fault (core dumped) zig build-exe func-print.zig
Before it crashes, the compiler steps hang for about a second, usually on a step involving Io.Writer.print__anon_<numbers>, although it's different every time:
Examples
[5632/5881] Linking
└─ Io.Threaded.posixConnect
[1780/1780] Code Generation
[7182] Semantic Analysis
└─ Io.Writer.print__anon_31707
[5624/5859] Linking
└─ Io.Threaded.posixConnectUnix
[1764/1764] Code Generation
[7158] Semantic Analysis
└─ Io.Writer.print__anon_31398
[5603/5881] Linking
└─ Io.Threaded.netReadPosix
[1780/1780] Code Generation
[7182] Semantic Analysis
└─ Io.Writer.print__anon_31705
[5337/5810] Linking
└─ mem.Allocator.allocWithSizeAndAlignment__anon_27135
[1720/1720] Code Generation
[7108] Semantic Analysis
└─ Io.Writer.print__anon_30225
[5670/5881] Linking
└─ Io.Writer.noopFlush
[1780/1780] Code Generation
[7182] Semantic Analysis
└─ Io.Writer.print__anon_31707
[5714/5881] Linking
└─ Io.Writer.printIntAny__anon_28552
[1790/1791] Code Generation
[7210] Semantic Analysis
└─ start._start
[5752/5940] Linking
└─ fmt.float.binaryToDecimal__anon_28592
[1792/1792] Code Generation
[7262] Semantic Analysis
└─ os.linux.tls.alignBackward
Expected behavior
A compiler error, like it produced in 0.15.2
### Zig Version
0.16.0 and 0.17.0-dev.607+456b2ec07
### Steps to Reproduce, Observed Behavior, and Expected Behavior
```zig
// func-print.zig
const std = @import("std");
fn foo() void {}
pub fn main() void {
std.debug.print("foo: {}", .{foo});
}
```
I ran this through 4 different versions of the compiler:
```shell
> zig env | grep target
.target = "x86_64-linux.6.12.68...6.12.68-gnu.2.42",
> zig version && zig build-exe func-print.zig
0.14.1
/home/pancelor/.local/app/zig/0.14.1/lib/std/fmt.zig:702:19: error: unable to format function body type, use '*const fn () void' for a function pointer type
.@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
> zig version && zig build-exe func-print.zig
0.15.2
/home/pancelor/.local/app/zig/0.15.2/lib/std/Io/Writer.zig:1383:19: error: unable to format function body type, use '*const fn () void' for a function pointer type
.@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
> zig version && zig build-exe func-print.zig
0.16.0
zsh: segmentation fault (core dumped) zig build-exe func-print.zig
> zig version && zig build-exe func-print.zig
0.17.0-dev.607+456b2ec07
zsh: segmentation fault (core dumped) zig build-exe func-print.zig
```
Before it crashes, the compiler steps hang for about a second, usually on a step involving `Io.Writer.print__anon_<numbers>`, although it's different every time:
<details><summary>Examples</summary>
```
[5632/5881] Linking
└─ Io.Threaded.posixConnect
[1780/1780] Code Generation
[7182] Semantic Analysis
└─ Io.Writer.print__anon_31707
```
```
[5624/5859] Linking
└─ Io.Threaded.posixConnectUnix
[1764/1764] Code Generation
[7158] Semantic Analysis
└─ Io.Writer.print__anon_31398
```
```
[5603/5881] Linking
└─ Io.Threaded.netReadPosix
[1780/1780] Code Generation
[7182] Semantic Analysis
└─ Io.Writer.print__anon_31705
```
```
[5337/5810] Linking
└─ mem.Allocator.allocWithSizeAndAlignment__anon_27135
[1720/1720] Code Generation
[7108] Semantic Analysis
└─ Io.Writer.print__anon_30225
```
```
[5670/5881] Linking
└─ Io.Writer.noopFlush
[1780/1780] Code Generation
[7182] Semantic Analysis
└─ Io.Writer.print__anon_31707
```
```
[5714/5881] Linking
└─ Io.Writer.printIntAny__anon_28552
[1790/1791] Code Generation
[7210] Semantic Analysis
└─ start._start
```
```
[5752/5940] Linking
└─ fmt.float.binaryToDecimal__anon_28592
[1792/1792] Code Generation
[7262] Semantic Analysis
└─ os.linux.tls.alignBackward
```
</details>
## Expected behavior
A compiler error, like it produced in 0.15.2