-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[C++] Side effect get removed if the return type of a unary operator is std::nullptr_t
#64923
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
Comments
@llvm/issue-subscribers-c-1 |
@llvm/issue-subscribers-clang-frontend |
@llvm/issue-subscribers-clang-codegen |
Thanks for reducing! Here is a corrected link for what I think you meant about changing the return type (your post currently has the same link twice). |
Most likely a problem in the constant interpreter, since this works with |
We don't bother evaluating either side of the expression when we know the type is nullptr_t Fix shortly, i just need to write a test! |
Thank you for the quick fix! |
This comes from #58459 but I find it is not related to coroutines after I reduce it.
Reproducer: https://godbolt.org/z/TGefxv5e5
From the generated code, we can see the call to
DoAnotherThing()
is elided incorrectly.And if we change the return type of
operator++
, we can find the problem is gone: https://godbolt.org/z/TGefxv5e5While I tagged
codegen
, I feel like this is a frontend issue.CC people since I know not so many people subscribed to the
c++
tag: @AaronBallman @cor3ntin @Endilll @erichkeaneThe text was updated successfully, but these errors were encountered: