aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-18 11:04:18 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-18 11:04:18 -0400
commitd49d6f0cde782f4ec3c1d623d58644c3e51a6ce9 (patch)
treec433020e6b41a8d465ed3708e5aadcef5e745a20 /test/compile_errors.zig
parent7151d72532ebc11fe72fda91d156082bd8c1761b (diff)
downloadzig-d49d6f0cde782f4ec3c1d623d58644c3e51a6ce9.tar.gz
zig-d49d6f0cde782f4ec3c1d623d58644c3e51a6ce9.zip
fix compiler crash when using @intToFloat with float literal
closes #1132
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index b51a6e9761..23337ca479 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,14 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "non int passed to @intToFloat",
+ \\export fn entry() void {
+ \\ const x = @intToFloat(f32, 1.1);
+ \\}
+ ,
+ ".tmp_source.zig:2:32: error: expected int type, found 'comptime_float'",
+ );
+ cases.add(
"use implicit casts to assign null to non-nullable pointer",
\\export fn entry() void {
\\ var x: i32 = 1234;