Skip to content

Bitfields: .init value contains void elements #22383

@ibuclaw

Description

@ibuclaw

i.e:

struct T
{
    int a = 4;
    int b : 16;
    int c : 16;
    int d = 8;
}
pragma(msg, T.init);

Prints:

T(4, 0, , 8)

Likewise

static assert(T.init == T(4,0,0,8));

Errors with

Error: integer constant expression expected instead of `void`
    int c : 16;
            ^

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