summary refs log tree commit diff stats
path: root/tests/array
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-12-30 07:50:12 +0800
committerGitHub <noreply@github.com>2022-12-30 00:50:12 +0100
commitc598d0b6eccd3133bfca710fc5fcc4576501862c (patch)
treeddc11b73bc0c389118c3c02bfea73d7798d1bd90 /tests/array
parentebd1c678be5e0acee4fca67e1b7060234821ccf6 (diff)
downloadNim-c598d0b6eccd3133bfca710fc5fcc4576501862c.tar.gz
fix #15117 zero size array cause incorrect codegen for VCC compiler (#21197)
fix #15117
Diffstat (limited to 'tests/array')
-rw-r--r--tests/array/t15117.nim27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/array/t15117.nim b/tests/array/t15117.nim
new file mode 100644
index 000000000..157b04bee
--- /dev/null
+++ b/tests/array/t15117.nim
@@ -0,0 +1,27 @@
+discard """
+  matrix: "--cc:vcc"
+  disabled: "linux"
+  disabled: "bsd"
+  disabled: "osx"
+  disabled: "unix"
+  disabled: "posix"
+"""
+{.experimental: "views".}
+
+let a: array[0, byte] = []
+discard a
+
+type B = object
+  a:int
+let b: array[0, B] = []
+let c: array[0, ptr B] = []
+let d: array[0, ref B] = []
+discard b
+discard c
+discard d
+
+discard default(array[0, B])
+
+type
+  View1 = openArray[byte]
+discard default(View1)