diff options
| author | 2026-10-14 16:13:27 +0330 | |
|---|---|---|
| committer | 2026-10-14 16:13:27 +0330 | |
| commit | 01125f4b3ced32230e19503ce72a2a9dac63c58d (patch) | |
| tree | 9b48b00217333961bc9380a926eb5f8e7a687ba2 /tests/conformance/5-declarations | |
| parent | fndef: a prototype after a definition in the same module keeps the definition... (diff) | |
globals: a float or f32 global takes a float literal initializer (appendix b.2.7)
Diffstat (limited to 'tests/conformance/5-declarations')
| -rw-r--r-- | tests/conformance/5-declarations/global_float_init_f32_and_list.zc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/conformance/5-declarations/global_float_init_f32_and_list.zc b/tests/conformance/5-declarations/global_float_init_f32_and_list.zc new file mode 100644 index 0000000..57df35b --- /dev/null +++ b/tests/conformance/5-declarations/global_float_init_f32_and_list.zc @@ -0,0 +1,8 @@ +// expect: 1/1/ +// spec 5.3.2 and appendix b.2.7: float globals take a float literal initializer +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +float a = 0.25, b = 2.5; +f32 c = 0.5; +fn main() { pn(a + b == 2.75); pn(c * 4.0 == 2.0); return 0; } +// zc0: skip |
