diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-11-25 18:16:33 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-11-25 18:16:33 -0500 |
| commit | a2afcae9ff1f2eed5c6a19a2bd63af288b9171ad (patch) | |
| tree | 14778ba4c1e3151888ca209dd06b4ba72d545569 /test/compile_errors.zig | |
| parent | 48ebb65cc7a976599c0a2b9e6647ea057727cf21 (diff) | |
| download | zig-a2afcae9ff1f2eed5c6a19a2bd63af288b9171ad.tar.gz zig-a2afcae9ff1f2eed5c6a19a2bd63af288b9171ad.zip | |
fix crash when constant inside comptime function has compile error
closes #625
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 9e15333750..3ef4a63e5f 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -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"); } |
