Merge pull request #2499 from JosephTurner/fix-uint-segv

Fixes #1986 when calling sameConstant on uint
This commit is contained in:
Andreas Rumpf
2015-04-09 09:37:05 +02:00
2 changed files with 11 additions and 1 deletions

View File

@@ -368,7 +368,7 @@ proc sameConstant*(a, b: PNode): bool =
case a.kind
of nkSym: result = a.sym == b.sym
of nkIdent: result = a.ident.id == b.ident.id
of nkCharLit..nkInt64Lit: result = a.intVal == b.intVal
of nkCharLit..nkUInt64Lit: result = a.intVal == b.intVal
of nkFloatLit..nkFloat64Lit: result = a.floatVal == b.floatVal
of nkStrLit..nkTripleStrLit: result = a.strVal == b.strVal
of nkType, nkNilLit: result = a.typ == b.typ

View File

@@ -0,0 +1,10 @@
# bug #1986 found by gdmoore
proc test(): int64 =
return 0xdeadbeef.int64
const items = [
(var1: test(), var2: 100'u32),
(var1: test(), var2: 192'u32)
]