aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorhfcc <42674143+hcff@users.noreply.github.com>2018-09-05 23:31:25 +0200
committerhfcc <42674143+hcff@users.noreply.github.com>2018-09-05 23:31:25 +0200
commit768d1fc539e425280acba5b30256e3b1267ddfbb (patch)
tree84ce94293869ea0d9706d9125f7ca38190ec3e97 /test/compile_errors.zig
parentffb3b1576b1c02942bce89ef05eaf05fe2f026ac (diff)
downloadzig-768d1fc539e425280acba5b30256e3b1267ddfbb.tar.gz
zig-768d1fc539e425280acba5b30256e3b1267ddfbb.zip
Added compilation error when a non-float is given to @floatToInt()
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index cbca4bb7e3..ce67f25ed7 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -496,6 +496,15 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
);
cases.add(
+ "non float passed to @floatToInt",
+ \\export fn entry() void {
+ \\ const x = @floatToInt(i32, 54);
+ \\}
+ ,
+ ".tmp_source.zig:2:32: error: expected float type, found 'comptime_int'",
+ );
+
+ cases.add(
"use implicit casts to assign null to non-nullable pointer",
\\export fn entry() void {
\\ var x: i32 = 1234;