Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cooldome authored and Araq committed Mar 23, 2018
1 parent a0b5470 commit e2c2ae8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions compiler/ccgexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,7 @@ proc upConv(p: BProc, n: PNode, d: var TLoc) =
if t.kind notin {tyVar, tyLent} or not p.module.compileToCpp:
r = "(*$1)" % [r]
t = skipTypes(t.lastSon, abstractInst)
discard getTypeDesc(p.module, t)
if not p.module.compileToCpp:
while t.kind == tyObject and t.sons[0] != nil:
add(r, ".Sup")
Expand Down
4 changes: 3 additions & 1 deletion tests/ccgbugs/mymodule.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
type
MyRefObject* = ref object
s: string


BaseObj* = ref object of RootObj
ChildObj* = ref object of BaseObj

proc newMyRefObject*(s: string): MyRefObject =
new(result)
Expand Down
5 changes: 5 additions & 0 deletions tests/ccgbugs/tforward_decl_only.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ proc f(foo: ptr Foo, foo2: ptr Foo2): cint =
if foo2 != nil: {.emit: [result, " = ", foo2[], ".b;"].}

discard f(nil, nil)


# bug #7392
var x1: BaseObj
var x2 = ChildObj(x1)

0 comments on commit e2c2ae8

Please sign in to comment.