fix crash when constant inside comptime function has compile error
closes #625
This commit is contained in:
@@ -2343,4 +2343,23 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
|
||||
\\pub extern fn foo(format: &const u8, ...);
|
||||
,
|
||||
".tmp_source.zig:2:9: error: expected type '&const u8', found '[5]u8'");
|
||||
|
||||
cases.add("constant inside comptime function has compile error",
|
||||
\\const ContextAllocator = MemoryPool(usize);
|
||||
\\
|
||||
\\pub fn MemoryPool(comptime T: type) -> type {
|
||||
\\ const free_list_t = @compileError("aoeu");
|
||||
\\
|
||||
\\ struct {
|
||||
\\ free_list: free_list_t,
|
||||
\\ }
|
||||
\\}
|
||||
\\
|
||||
\\export fn entry() {
|
||||
\\ var allocator: ContextAllocator = undefined;
|
||||
\\}
|
||||
,
|
||||
".tmp_source.zig:4:25: error: aoeu",
|
||||
".tmp_source.zig:1:36: note: called from here",
|
||||
".tmp_source.zig:12:20: note: referenced here");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user