From fc100d7b3b27bd514dca4e02c160e5b96d4da648 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 9 Feb 2017 02:50:03 -0500 Subject: lots of miscellaneous things all in one big commit * add `@compileLog(...)` builtin function - Helps debug code running at compile time - See #240 * fix crash when there is an error on the start value of a slice * add implicit cast from int and float types to int and float literals if the value is known at compile time * make array concatenation work with slices in addition to arrays and c string literals * fix compile error message for something not having field access * fix crash when `@setDebugSafety()` was called from a function being evaluated at compile-time * fix compile-time evaluation of overflow math builtins. * avoid debug safety panic handler in builtin.o and compiler_rt.o since we use no debug safety in these modules anyway * add compiler_rt functions for division on ARM - Closes #254 * move default panic handler to std.debug so users can call it manually * std.io.printf supports a width in the format specifier --- test/cases/eval.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/cases/eval.zig') diff --git a/test/cases/eval.zig b/test/cases/eval.zig index 9f3b1d2fcd..027bb643b6 100644 --- a/test/cases/eval.zig +++ b/test/cases/eval.zig @@ -251,3 +251,15 @@ fn comptimeIterateOverFnPtrList() { assert(performFn('o', 0) == 1); assert(performFn('w', 99) == 99); } + +fn evalSetDebugSafetyAtCompileTime() { + @setFnTest(this); + + const result = comptime fnWithSetDebugSafety(); + assert(result == 1234); +} + +fn fnWithSetDebugSafety() -> i32{ + @setDebugSafety(this, true); + return 1234; +} -- cgit v1.2.3