fix #15117
This commit is contained in:
parent
ebd1c678be
commit
c598d0b6ec
2 changed files with 29 additions and 0 deletions
|
|
@ -3331,6 +3331,8 @@ proc genConstObjConstr(p: BProc; n: PNode; isConst: bool; result: var Rope) =
|
|||
|
||||
proc genConstSimpleList(p: BProc, n: PNode; isConst: bool; result: var Rope) =
|
||||
result.add "{"
|
||||
if p.vccAndC and n.len == 0 and n.typ.kind == tyArray:
|
||||
getDefaultValue(p, n.typ[1], n.info, result)
|
||||
for i in 0..<n.len:
|
||||
let it = n[i]
|
||||
if i > 0: result.add ",\n"
|
||||
|
|
|
|||
27
tests/array/t15117.nim
Normal file
27
tests/array/t15117.nim
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue