Skip to content

wrong code generated for bitfield assignment to ?: #18101

@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

Walter Bright (@WalterBright) reported this on 2022-04-27T22:18:00Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=23064

CC List

  • basile-z

Description

The generated code is as if a.x and a.y were regular fields instead of bitfields.

struct A { int x: 3; int y: 5; } a;

struct A test(int val, int choice, struct A a)
{
    (choice ? a.x : a.y) = val;
    return a;
}

Affects D and ImportC.

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