https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101027
Martin Hořeňovský <martin.horenovsky+gccbugzilla at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |martin.horenovsky+gccbugzil
| |la at gmail dot com
--- Comment #5 from Martin Hořeňovský <martin.horenovsky+gccbugzilla at gmail
dot com> ---
Another reproducer is short-circuiting after a comma operator
```
#include <iostream>
#include <coroutine>
struct promise;
struct coroutine : std::coroutine_handle<promise> {
using promise_type = ::promise;
};
struct promise {
coroutine get_return_object() { return {coroutine::from_promise(*this)}; }
std::suspend_never initial_suspend() noexcept { return {}; }
std::suspend_never final_suspend() noexcept { return {}; }
void return_void() {
}
void unhandled_exception() {
}
};
struct Awaitable {
bool await_ready() {
static int counter{};
std::cout << ++counter << std::endl;
return true;
}
void await_suspend(std::coroutine_handle<>) {
}
bool await_resume() {
return true;
}
};
coroutine f() {
Awaitable a{};
// Ignored
bool b = false && static_cast<const bool &>(!!(co_await a));
// Evaluates
(0, false && static_cast<const bool &>(!!(co_await a)));
}
int main() {
f();
}
------
Prints "1". Interestingly, the simple short-circuiting expression works
properly, but the one after comma operator does not.