This commit is contained in:
Andreas Rumpf
2016-08-30 11:26:23 +02:00
parent 0a90613288
commit f6a2ff731b
2 changed files with 13 additions and 1 deletions

View File

@@ -1075,7 +1075,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
of tyBuiltInTypeClass:
considerPreviousT:
let targetKind = f.sons[0].kind
if targetKind == a.skipTypes({tyRange, tyGenericInst}).kind or
if targetKind == a.skipTypes({tyRange, tyGenericInst, tyBuiltInTypeClass}).kind or
(targetKind in {tyProc, tyPointer} and a.kind == tyNil):
put(c, f, a)
return isGeneric

View File

@@ -0,0 +1,12 @@
# bug #4672
type
EnumContainer[T: enum] = object
v: T
SomeEnum {.pure.} = enum
A,B,C
proc value[T: enum](this: EnumContainer[T]): T =
this.v
var enumContainer: EnumContainer[SomeEnum]
discard enumContainer.value()