exportc is now not allowed for type aliases (#9979)
This commit is contained in:
parent
9fb8c3d965
commit
7c5ae00887
2 changed files with 14 additions and 0 deletions
|
|
@ -1101,6 +1101,8 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
|
||||||
#debug s.typ
|
#debug s.typ
|
||||||
s.ast = a
|
s.ast = a
|
||||||
popOwner(c)
|
popOwner(c)
|
||||||
|
if sfExportc in s.flags and s.typ.kind == tyAlias:
|
||||||
|
localError(c.config, name.info, "{.exportc.} not allowed for type aliases")
|
||||||
let aa = a.sons[2]
|
let aa = a.sons[2]
|
||||||
if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and
|
if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and
|
||||||
aa.sons[0].kind == nkObjectTy:
|
aa.sons[0].kind == nkObjectTy:
|
||||||
|
|
|
||||||
12
tests/pragmas/t5149.nim
Normal file
12
tests/pragmas/t5149.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "{.exportc.} not allowed for type aliases"
|
||||||
|
line: 9
|
||||||
|
"""
|
||||||
|
|
||||||
|
type
|
||||||
|
X* = object
|
||||||
|
a: int
|
||||||
|
Y* {.exportc.} = X
|
||||||
|
|
||||||
|
proc impl*(x: X) =
|
||||||
|
echo "it works"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue