summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorNeelesh Chandola <neelesh.chandola@outlook.com>2018-12-09 10:25:04 +0530
committerNeelesh Chandola <neelesh.chandola@outlook.com>2018-12-09 10:28:34 +0530
commitb0f860d90fefc89219c1e2bc9f8815cde07a7b7c (patch)
treee61efea03087cbfb3668a109cca685dfed705957 /compiler
parent7a66616d741106d4c18ce2e8f843a8b5d31f6025 (diff)
downloadNim-b0f860d90fefc89219c1e2bc9f8815cde07a7b7c.tar.gz
Fix enum regression
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtypes.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index a011a8fc8..294cabe47 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -90,6 +90,8 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
         if sonsLen(v) == 2:
           strVal = v.sons[1] # second tuple part is the string value
           if skipTypes(strVal.typ, abstractInst).kind in {tyString, tyCString}:
+            if not isOrdinalType(v.sons[0].typ):
+              localError(c.config, v.sons[0].info, errOrdinalTypeExpected)
             x = getOrdValue(v.sons[0]) # first tuple part is the ordinal
           else:
             localError(c.config, strVal.info, errStringLiteralExpected)