parent
238809f506
commit
52f03fabc1
2 changed files with 28 additions and 1 deletions
|
|
@ -449,7 +449,9 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
|
||||||
of nkRecCase:
|
of nkRecCase:
|
||||||
if n.sons[0].kind != nkSym: internalError(m.config, n.info, "genRecordFieldsAux")
|
if n.sons[0].kind != nkSym: internalError(m.config, n.info, "genRecordFieldsAux")
|
||||||
add(result, genRecordFieldsAux(m, n.sons[0], accessExpr, rectype, check))
|
add(result, genRecordFieldsAux(m, n.sons[0], accessExpr, rectype, check))
|
||||||
let uname = rope(mangle(n.sons[0].sym.name.s) & 'U')
|
# prefix mangled name with "_U" to avoid clashes with other field names,
|
||||||
|
# since identifiers are not allowed to start with '_'
|
||||||
|
let uname = rope("_U" & mangle(n.sons[0].sym.name.s))
|
||||||
let ae = if accessExpr != nil: "$1.$2" % [accessExpr, uname]
|
let ae = if accessExpr != nil: "$1.$2" % [accessExpr, uname]
|
||||||
else: uname
|
else: uname
|
||||||
var unionBody: Rope = nil
|
var unionBody: Rope = nil
|
||||||
|
|
|
||||||
25
tests/ccgbugs/t8781.nim
Normal file
25
tests/ccgbugs/t8781.nim
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
discard """
|
||||||
|
output: ""
|
||||||
|
"""
|
||||||
|
|
||||||
|
type
|
||||||
|
Drawable = object of RootObj
|
||||||
|
discard
|
||||||
|
|
||||||
|
# issue #8781, following type was broken due to 'U' suffix
|
||||||
|
# on `animatedU`. U also added as union identifier for C.
|
||||||
|
# replaced by "_U" prefix, which is not allowed as an
|
||||||
|
# identifier
|
||||||
|
TypeOne = ref object of Drawable
|
||||||
|
animatedU: bool
|
||||||
|
case animated: bool
|
||||||
|
of true:
|
||||||
|
frames: seq[int]
|
||||||
|
of false:
|
||||||
|
region: float
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
let r = 1.5
|
||||||
|
let a = TypeOne(animatedU: true,
|
||||||
|
animated: false,
|
||||||
|
region: r)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue