Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for enums with custom integer types #696

Closed
BHolman-LBI opened this issue Apr 4, 2022 · 2 comments · Fixed by #1481
Closed

Add support for enums with custom integer types #696

BHolman-LBI opened this issue Apr 4, 2022 · 2 comments · Fixed by #1481
Labels
enhancement New feature or request

Comments

@BHolman-LBI
Copy link
Contributor

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?

@BHolman-LBI BHolman-LBI added the bug Something isn't working label Apr 4, 2022
@SanderMertens SanderMertens added enhancement New feature or request and removed bug Something isn't working labels Apr 5, 2022
@SanderMertens SanderMertens changed the title Setting an enum type causes heap corruption Add support for enums with custom integer types Apr 5, 2022
@SanderMertens
Copy link
Owner

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

@SanderMertens
Copy link
Owner

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

@SanderMertens SanderMertens added the will take a while This will take a while label Apr 5, 2022
@SanderMertens SanderMertens removed the will take a while This will take a while label Dec 19, 2024
SanderMertens added a commit that referenced this issue Dec 19, 2024
* #696 Add support for enums with customizable underlying types

* #696 Add support for customizable underlying enum types for C++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@SanderMertens @BHolman-LBI and others