mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-30 16:45:38 +00:00
fixes #23765; Method calling proc with return value overlapping declared generic type generates invalid C
This commit is contained in:
@@ -81,7 +81,8 @@ proc sameInstantiation(a, b: TInstantiation): bool =
|
||||
if not compareTypes(a.concreteTypes[i], b.concreteTypes[i],
|
||||
flags = {ExactTypeDescValues,
|
||||
ExactGcSafety,
|
||||
PickyCAliases}): return
|
||||
PickyCAliases,
|
||||
PickyBackendAliases}): return
|
||||
result = true
|
||||
else:
|
||||
result = false
|
||||
|
||||
@@ -52,7 +52,8 @@ proc searchInstTypes*(g: ModuleGraph; key: PType): PType =
|
||||
for j in FirstGenericParamAt..<key.kidsLen:
|
||||
# XXX sameType is not really correct for nested generics?
|
||||
if not compareTypes(inst[j], key[j],
|
||||
flags = {ExactGenericParams, PickyCAliases}):
|
||||
flags = {ExactGenericParams, PickyCAliases,
|
||||
PickyBackendAliases}):
|
||||
break matchType
|
||||
|
||||
return inst
|
||||
|
||||
@@ -75,3 +75,19 @@ block: # importc type inheritance
|
||||
doAssert(cast[cint](b) == 123)
|
||||
var c = foo(b)
|
||||
doAssert(cast[cint](c) == 123)
|
||||
|
||||
|
||||
# bug #23765
|
||||
type
|
||||
X11[T, E] = object
|
||||
m: T
|
||||
B = X11[culonglong, cstring]
|
||||
S = ref object of RootObj
|
||||
|
||||
proc j[T, E](m: X11[T, E]): T = discard
|
||||
proc n(T: typedesc[SomeUnsignedInt]): X11[T, cstring] = discard
|
||||
method call(client: S): uint64 {.base.} =
|
||||
discard j(n(uint64))
|
||||
|
||||
var s = S()
|
||||
discard s.call()
|
||||
Reference in New Issue
Block a user