aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-07-10 10:12:08 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-07-10 10:12:08 -0400
commit28f9230b40ee7aa179705c39616aaf2a5f303b73 (patch)
treec8fabad00b800c43143fe148557c23a64c129de0 /test/compile_errors.zig
parentb5cfbfd84ee26d5174abf3368b75b9e4502898a5 (diff)
downloadzig-28f9230b40ee7aa179705c39616aaf2a5f303b73.tar.gz
zig-28f9230b40ee7aa179705c39616aaf2a5f303b73.zip
fix crash when calling comptime-known undefined function ptr
closes #880 closes #1212
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 1b76c01564..a6db8d50b4 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,19 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "use of comptime-known undefined function value",
+ \\const Cmd = struct {
+ \\ exec: fn () void,
+ \\};
+ \\export fn entry() void {
+ \\ const command = Cmd{ .exec = undefined };
+ \\ command.exec();
+ \\}
+ ,
+ ".tmp_source.zig:6:12: error: use of undefined value",
+ );
+
+ cases.add(
"bad @alignCast at comptime",
\\comptime {
\\ const ptr = @intToPtr(*i32, 0x1);