Reject enums with holes when computedGoto is used (#8132)

Fixes #7699
This commit is contained in:
LemonBoy 2018-06-27 21:36:52 +02:00 • committed by Andreas Rumpf
commit 722abbe9c9
2 changed files with 18 additions and 0 deletions

View file

@ -404,6 +404,9 @@ proc genComputedGoto(p: BProc; n: PNode) =
localError(p.config, it.info,
"case statement must be exhaustive for computed goto"); return
casePos = i
if enumHasHoles(it.sons[0].typ):
localError(p.config, it.info,
"case statement cannot work on enums with holes for computed goto"); return
let aSize = lengthOrd(p.config, it.sons[0].typ)
if aSize > 10_000:
localError(p.config, it.info,