SanderMertens / flecs

A fast entity component system (ECS) for C & C++
https://www.flecs.dev
Other
6.46k stars 454 forks source link

Add support for enums with custom integer types #696

Open BHolman-LBI opened 2 years ago

BHolman-LBI commented 2 years ago

Describe the bug Unsure if this is a bug or a feature request:

The following snippet compiles and triggers a heap corruption runtime check on MSVC

enum class ETest : uint8_t
{
    A, B
};
int main()
{

    flecs::world ecs;

    ecs.component<ETest>();
    ecs.entity().set<ETest>(1);
    return 0;
}

Expected behavior I don't think the above should be allowed to compile?

SanderMertens commented 2 years ago

Updated the description, this is not currently supported. Will look into why it crashes though, that's not nice.

SanderMertens commented 2 years ago

Added an assert that checks if the enum is of the correct size.