diff options
author | Bung <crc32@qq.com> | 2023-08-04 19:35:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 13:35:43 +0200 |
commit | 26f183043f9e58eb4954d50a5d130d8684909936 (patch) | |
tree | 22935c744575ffed86fddc340317502e1c73dd1d /compiler/semexprs.nim | |
parent | 3efabd3ec669914ad2bb42a614f7277caf662562 (diff) | |
download | Nim-26f183043f9e58eb4954d50a5d130d8684909936.tar.gz |
fix #20883 Unspecified generic on default value segfaults the compiler (#21172)
* fix #20883 Unspecified generic on default value segfaults the compiler * fallback to isGeneric * change to closer error * Update t20883.nim
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r-- | compiler/semexprs.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 398424bbf..b7fc7a9bd 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -238,6 +238,9 @@ proc checkConvertible(c: PContext, targetTyp: PType, src: PNode): TConvStatus = result = convNotInRange else: # we use d, s here to speed up that operation a bit: + if d.kind == tyFromExpr: + result = convNotLegal + return case cmpTypes(c, d, s) of isNone, isGeneric: if not compareTypes(targetTyp.skipTypes(abstractVar), srcTyp.skipTypes({tyOwned}), dcEqIgnoreDistinct): |