aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorMarc Tiehuis <marctiehuis@gmail.com>2017-08-07 18:06:06 +1200
committerMarc Tiehuis <marctiehuis@gmail.com>2017-08-07 18:08:09 +1200
commit0705b711f8dd447f4eb4f1517be985ce09bce22f (patch)
treef1285716b6bce9a6ba538808c4825fb86a8e6024 /test/compile_errors.zig
parentd8227c79a2ff7882a52bf53f9ded2db4e7081fc8 (diff)
downloadzig-0705b711f8dd447f4eb4f1517be985ce09bce22f.tar.gz
zig-0705b711f8dd447f4eb4f1517be985ce09bce22f.zip
Correct floating-point literal allowed ranges
The exponent range for floating-point values is [-1022, 1023]. Fixes #399.
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index e4b42b12a4..c78d17a916 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -1931,4 +1931,18 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
\\}
,
".tmp_source.zig:1:13: error: struct 'Foo' contains itself");
+
+ cases.add("float literal too large error",
+ \\comptime {
+ \\ const a = 0x1.0p1024;
+ \\}
+ ,
+ ".tmp_source.zig:2:15: error: float literal out of range of any type");
+
+ cases.add("float literal too small error (denormal)",
+ \\comptime {
+ \\ const a = 0x1.0p-1023;
+ \\}
+ ,
+ ".tmp_source.zig:2:15: error: float literal out of range of any type");
}