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

Make intptr_union an std::variant #12

Open
Nydauron opened this issue Apr 24, 2023 · 0 comments
Open

Make intptr_union an std::variant #12

Nydauron opened this issue Apr 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@Nydauron
Copy link
Contributor

Currently, we've modified intptr_union to be the following definition:

typedef struct {
    int i;
    void *p;
    std::shared_ptr<char> s;
} intptr_union;

before that change, it was:

typedef union {
    int i;
    void* p;
} intptr_union;

This change was made to help fix some memory leaks within the parser.

We ideally want to wrap all 3 different types in a std::variant since that behaves exactly like union but allows for objects to be constructed/destructed, but currently, there some Spim test files that are causing the parser to panic due to a mismatch of type assert. If we can, we should add type checking before we unwrap the std::variant and handle accordingly if it is a different value.

To see what it was like when we first tried to use std::variant see acdfc84.
Note that commit 155e9ab reverted these changes.

@Nydauron Nydauron added the bug Something isn't working label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant