Skip to content

IRGen failure with conditional operator which produces an lvalue bitfield #14181

@zygoloid

Description

@zygoloid
mannequin
Bugzilla Link 13809
Version unspecified
OS Linux
CC @DougGregor

Extended Description

Clang dies on this:

struct S { int x : 5, y : 9; };
void f(bool c, S &a) { (c ? a.x : a.y) = 4; }

... saying:

:2:31: error: cannot compile this conditional operator yet
void f(bool c, S &a, S &b) { (c ? a.x : a.y) = 4; }
^~~~~~~~~~~~~

We're also getting Sema wrong for this case. We accept:

int &g(bool c, S &a, S &b) { return (c ? a.x : a.y); }

... but we should not, because it binds a reference to a bitfield.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:codegenIR generation bugs: mangling, exceptions, etc.confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions