Skip to content

Wrong ABI size for imported enum #24589

@arnetheduck

Description

@arnetheduck

Description

Importing enum into Nim is broadly a bad idea given the semantic differences, but it's done anyway - when doing so, Nim should respect C enum ABI rules - in particular, an enum is sized as cint by default most of the time but not always.

type X {.importc: "someenum".} = enum
  ...

Failing to do so leads silent miscompiles (and fails -d:checkAbi)

Nim Version

devel

Current Output

No response

Expected Output

No response

Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions