diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-08-07 15:57:41 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-08-07 15:57:41 -0400 |
| commit | 2234788fa80dfaf1e58df51ff576701f8161b0df (patch) | |
| tree | c544704e7d4981e2cae1c54abb4e6b17bc872268 /test/compile_errors.zig | |
| parent | 38b47d8aca57efbb10b8000cb726eb24b1f37ccb (diff) | |
| download | zig-2234788fa80dfaf1e58df51ff576701f8161b0df.tar.gz zig-2234788fa80dfaf1e58df51ff576701f8161b0df.zip | |
add ability to explicitly cast float to integer
closes #414
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index c78d17a916..58df6ce123 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1945,4 +1945,11 @@ pub fn addCases(cases: &tests.CompileErrorContext) { \\} , ".tmp_source.zig:2:15: error: float literal out of range of any type"); + + cases.add("explicit cast float literal to integer when there is a fraction component", + \\export fn entry() -> i32 { + \\ i32(12.34) + \\} + , + ".tmp_source.zig:2:9: error: fractional component prevents float value 12.340000 from being casted to type 'i32'"); } |
