Skip to content

Commit

Permalink
close #10815
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Oct 23, 2020
1 parent ae320b4 commit d41fcb6
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/vm/tvmmisc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,34 @@ block:
doAssert d == @[]
doAssert e == @[]
doAssert f == @[]



block: # bug #10815
block:
# this used to crash
type
Opcode = enum
iChar, iSet
Inst = object
case code: Opcode
of iChar:
c: char
of iSet:
cs: set[char]

Patt = seq[Inst]
proc `$`(p: Patt): string =
discard
proc P(): Patt =
result.add Inst(code: iSet)
const a = P()
doAssert $a == ""

block:
# probably used to crash
type CharSet {.union.} = object
cs: set[char]
vs: array[4, uint64]
const a = Charset(cs: {'a'..'z'})
doAssert a.repr.len > 0

0 comments on commit d41fcb6

Please sign in to comment.