-
Notifications
You must be signed in to change notification settings - Fork 235
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
Undefined Behavior to access non active union member #59
Comments
I think we need to check if there are more union UB code. |
Shell we use std::variant instead of union? however maybe visiting union is more efficient. |
Of course, it is always good to eliminate UB.
I think the readability and maintainability is more important given it wouldn't hurt performance much. @RainMark how do you think about? |
the SimpleExecutor's ContextUnion looks like can be removed, static_cast void* to int64_t directly? And the other tagged union keep it firstly? |
I think it's acceptable, but we should make sure no UB anymore. |
This is the right direction. But we couldn't |
I agree, union is not safe, we'd better use std::variant as safe union. |
Yeah, I agree |
Search before asking
What happened + What you expected to happen
Extract from: https://www.reddit.com/r/cpp/comments/ta4h29/async_simple_a_c20_coroutine_library/:
It is undefined behavior, access to non active union member
Reproduction way
Anything else
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: