Revert "fixes #13195"

This reverts commit cd7904f2b2.
This commit is contained in:
Andrii Riabushenko 2020-01-19 20:33:23 +00:00
commit 6f3476d39c
3 changed files with 4 additions and 29 deletions

View file

@ -525,8 +525,7 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
of nkOfBranch, nkElse:
let k = lastSon(n[i])
if k.kind != nkSym:
let structName = "_" & mangleRecFieldName(m, n[0].sym) & "_" & $i
let a = genRecordFieldsAux(m, k, rectype, check, unionPrefix & $structName & ".")
let a = genRecordFieldsAux(m, k, rectype, check, unionPrefix & "_i" & $i & ".")
if a != nil:
if tfPacked notin rectype.flags:
unionBody.add("struct {")
@ -536,7 +535,7 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
else:
unionBody.addf("#pragma pack(push, 1)$nstruct{", [])
unionBody.add(a)
unionBody.addf("} $1;$n", [structName])
unionBody.addf("} _i$1;$n", [rope($i)])
if tfPacked in rectype.flags and hasAttribute notin CC[m.config.cCompiler].props:
unionBody.addf("#pragma pack(pop)$n", [])
else: