Skip to content

[C++] Side effect get removed if the return type of a unary operator is std::nullptr_t #64923

@ChuanqiXu9

Description

@ChuanqiXu9

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/TGefxv5e5

While 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 @erichkeane

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions