Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Compiler assert: Casting bitstruct to short/char #2237

@cbuttner

Description

@cbuttner
bitstruct Foo : ushort {
  bool bar;
}

fn void main() {
  ushort foo = (ushort)((Foo) {.bar}) & 1;
}
⚠️ The compiler encountered an unexpected error: "Violated assert: expr->const_expr.const_kind == CONST_INTEGER || expr->const_expr.const_kind == CONST_ENUM".

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingFixed needs testingNeeds verification / testing that it now works

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions