SanderMertens / flecs

A fast entity component system (ECS) for C & C++
https://www.flecs.dev
MIT License
5.7k stars 411 forks source link

filter_builder() assert fail, when use term().or_() #1169

Closed hallomorld closed 1 month ago

hallomorld commented 3 months ago

Describe the bug filterbuilder() assert fail, when use .term().or() .term() This issue is problematic in flecs 3.2.10 or later. The old version works fine.

To Reproduce Steps to reproduce the behavior: flecs 3.2.10 or more new `

  #include <flecs.h>

  struct TagA {
  };

  struct StructB {
      int i = 0;
  };

  int main(int argc, char *argv[]) {

      flecs::world w;
      w.component<TagA>();
      w.component<StructB>();

      auto filter = w.filter_builder<>()
              .term<TagA>().or_()
              .term<StructB>()
              .build();

      filter.each([](flecs::iter &iter, size_t index) {});

      w.app().run();
      return 0;
  }

`

Expected behavior fatal: filter.c: 1391: assert: filter_terms <= term_count INTERNAL_ERROR

SanderMertens commented 3 months ago

Oh wow, that's a bad one to fly under the radar of the test suite! Taking a look.

SanderMertens commented 1 month ago

Fixed!