Skip to content

Error overlapping initialization for D bit-fields #21660

@ibuclaw

Description

@ibuclaw
struct S
{
    int a : 3;
    int b : 3;
}

void test()
{
    S s = S(1, 2);      // Error: overlapping initialization for `b`
    S s = S(a:1, b:2);  // Error: overlapping initialization for `b
}

This behaviour is not seen when compiling C code via importc.

struct S
{   
    int a : 3;
    int b : 3;
};

int main()
{
    struct S s = {1, 2};       // OK
    struct S t = {.a=1, .b=2}; // OK
    __check(s.a == 1);
    __check(s.b == 2);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions