Skip to content

Commit

Permalink
imported objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Jan 23, 2025
1 parent 7fe5e40 commit 59ebc32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/semstmts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1793,10 +1793,10 @@ proc typeSectionFinalPass(c: PContext, n: PNode) =
if pragmas[i].kind == nkExprColonExpr and
pragmas[i][0].kind == nkIdent and
whichKeyword(pragmas[i][0].ident) == wSize:
if s.typ.kind notin {tyObject, tyEnum}:
if s.typ.kind != tyEnum and sfImportC notin s.flags:
# EventType* {.size: sizeof(uint32).} = enum
# AtomicFlag* {.importc: "atomic_flag", header: "<stdatomic.h>", size: 1.} = object
localError(c.config, pragmas[i].info, "size pragma only allowed for objects and enums")
localError(c.config, pragmas[i].info, "size pragma only allowed for imported objects and enums")

if a[1].kind == nkEmpty:
var x = a[2]
Expand Down

0 comments on commit 59ebc32

Please sign in to comment.