Skip to content

Translate-C: type of enum value does not match type of enum #21220

@arctic-marmoset

Description

@arctic-marmoset

Zig Version

0.14.0-dev.1320+492cc2ef8

Steps to Reproduce and Observed Behavior

Given the following header:

// header.h
enum MyEnum {
    MyEnumValue,
};

zig translate-c header.h produces the following output:

// -snip-
pub const MyEnumValue: c_int = 0;
pub const enum_MyEnum = c_uint;
// -snip-
pub const MyEnum = enum_MyEnum;

Expected Behavior

@TypeOf(MyEnumValue) should equal MyEnum.

In particular, I would have expected MyEnum to be c_int as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions