Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 authored Dec 28, 2022
1 parent 3d5dbf8 commit 7a74c2d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/ccgexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3200,6 +3200,8 @@ proc getDefaultValue(p: BProc; typ: PType; info: TLineInfo; result: var Rope) =
result.add "}"
of tyTuple:
result.add "{"
if p.vccAndC and t.len == 0:
result.add "0"
for i in 0..<t.len:
if i > 0: result.add ", "
getDefaultValue(p, t[i], info, result)
Expand Down Expand Up @@ -3338,6 +3340,8 @@ proc genConstSimpleList(p: BProc, n: PNode; isConst: bool; result: var Rope) =

proc genConstTuple(p: BProc, n: PNode; isConst: bool; tup: PType; result: var Rope) =
result.add "{"
if p.vccAndC and n.len == 0:
result.add "0"
for i in 0..<n.len:
let it = n[i]
if i > 0: result.add ",\n"
Expand Down
1 change: 1 addition & 0 deletions compiler/cgendata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ type

template config*(m: BModule): ConfigRef = m.g.config
template config*(p: BProc): ConfigRef = p.module.g.config
template vccAndC*(p: BProc): bool = p.module.config.cCompiler == ccVcc and p.module.config.backend == backendC

proc includeHeader*(this: BModule; header: string) =
if not this.headerFiles.contains header:
Expand Down
12 changes: 12 additions & 0 deletions tests/misc/t14667.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
discard """
matrix: "--cc:vcc"
disabled: "linux"
disabled: "bsd"
disabled: "osx"
disabled: "unix"
disabled: "posix"
"""

type A = tuple
discard ()
discard default(A)

0 comments on commit 7a74c2d

Please sign in to comment.