Fix codegen for set[T] parameters

Sometimes sets are materialized as arrays and we must treat them as
such: the CPP backend is pickier than the C one and would sometimes
produce invalid code.

Fixes #8967
This commit is contained in:
LemonBoy 2018-09-15 00:09:50 +02:00
commit 6af6ca6351
3 changed files with 20 additions and 8 deletions

10
tests/ccgbugs/t8967.nim Normal file
View file

@ -0,0 +1,10 @@
discard """
targets: "c cpp"
"""
import marshal
let orig: set[char] = {'A'..'Z'}
let m = $$orig
let old = to[set[char]](m)
doAssert orig - old == {}