Thanks to visit codestin.com
Credit goes to github.com

Skip to content

incorrect error: exported enum value must be declared extern #9498

@Jarred-Sumner

Description

@Jarred-Sumner

If you export an enum, you get this message:

./src/javascript/jsc/bindings/exports.zig:721:22: error: exported enum value must be declared extern
    @export(ErrorCode.ParserErrorCode, .{ .name = "Zig_ErrorCodeParserError" });
                     ^

If you follow the suggestion in the above error, you get an error that enums cannot be extern

/Users/jarred/Code/esdev/src/javascript/jsc/bindings/exports.zig:110:23: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type
pub const ErrorCode = extern enum(ErrorCodeInt) {
                      ^

This feels like a bug, maybe in AST check or maybe in @export.

For now, I can work around this with an @enumToInt:

    pub const ParserErrorCode = @enumToInt(ErrorCode.from(error.ParserError));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions