Skip to content

Crash on switch statement while editing previous scope (SIGSEGV) #411

@MightyPrinny

Description

@MightyPrinny

I was writting something like this and I found that it always crashes after modifying the part before the switch

enum MyEnum {
   First,
   Second,
   Third
}

struct MyThing {
   int x;
   MyEnum thing;
}

void thing() {
   MyThing thing;
   MyThing thing2;
   MyThing thing3;
   MyThing[] things = [thing, thing2, thing3];

   foreach (const ref MyThing t; things) {
      switch (t.thing) {
      case MyEnum.First:
         break;
      case MyEnum.Second:
         break;
      default:
         break;
      }

   }

}

For example it crashes after adding something like:

int i
 switch (t.thing) {
      case MyEnum.First:
...

This causes a segfault in libc.

I saw this in the log before the crash:

Expected `;` instead of `switch`\n"

I tested with master and the latest beta, I'm using it in Neovim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions