diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2018-06-27 21:41:40 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-06-27 21:41:40 +0200 |
commit | 7f148838a461397f75853945e33eef29583dcc57 (patch) | |
tree | 72f5e3858c8a7f407f885456bb2f8a915b5a0a9c /compiler | |
parent | 5ac74da926c6d37c92f819d6b5d2e29f472a3fbb (diff) | |
download | Nim-7f148838a461397f75853945e33eef29583dcc57.tar.gz |
Reject ptr/ref void types (#8127)
Do this during the semantic pass to avoid tripping the following passes. Fixes #6454
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semtypes.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index d1ebb950c..dfd424705 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -177,6 +177,9 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType = var t = semTypeNode(c, n.lastSon, nil) if t.kind == tyTypeDesc and tfUnresolved notin t.flags: t = t.base + if t.kind == tyVoid: + const kindToStr: array[tyPtr..tyRef, string] = ["ptr", "ref"] + localError(c.config, n.info, "type '$1 void' is not allowed" % kindToStr[kind]) result = newOrPrevType(kind, prev, c) var isNilable = false # check every except the last is an object: |