parent
432a4d1787
commit
1ec5c6fdf5
2 changed files with 15 additions and 1 deletions
|
|
@ -122,7 +122,7 @@ proc computeObjectOffsetsFoldFunction(conf: ConfigRef; n: PNode, initialOffset:
|
||||||
let size = n.sym.typ.size
|
let size = n.sym.typ.size
|
||||||
let align = n.sym.typ.align
|
let align = n.sym.typ.align
|
||||||
result.align = align
|
result.align = align
|
||||||
if initialOffset == szUnknownSize:
|
if initialOffset == szUnknownSize or size == szUnknownSize:
|
||||||
n.sym.offset = szUnknownSize
|
n.sym.offset = szUnknownSize
|
||||||
result.offset = szUnknownSize
|
result.offset = szUnknownSize
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -350,5 +350,19 @@ testinstance:
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
{.emit: """/*TYPESECTION*/
|
||||||
|
typedef struct{
|
||||||
|
float a; float b;
|
||||||
|
} Foo;
|
||||||
|
""".}
|
||||||
|
|
||||||
|
type
|
||||||
|
Foo {.importc.} = object
|
||||||
|
|
||||||
|
Bar = object
|
||||||
|
b: byte
|
||||||
|
foo: Foo
|
||||||
|
|
||||||
|
assert sizeof(Bar) == 12
|
||||||
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue