Skip to content

C compilation errors on builtin module #499

@ellxor

Description

@ellxor

The functions in the builtin module produce a C compilation error as they are defined to return u8, but the C __builtin_xxx equivalents return int. The forward declaration produced results in a type mismatch.

Minimal example to reproduce:

module example;
import builtin as b;

public fn i32 main(i32 argc, char **argv) {
    return b.popcount(cast<u32>(argc));
}

This gives an error with clang and a warning and link error with GCC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions