Closed Naios closed 5 years ago
I have been cleaning up older and inactive GitHub googletest issues. You may see an issue "closed" if it appears to be inactive/abandoned Thank you
I'm facing this issue as well, using latest main (34ad51b3dc4f922d8ab622491dd44fc2c39afee9
). It makes it impossible to use any GTest macro from within a coroutine. Example:
#include <gtest/gtest.h>
#include <coroutine>
struct ExampleCoroutine
{
struct promise_type
{
std::suspend_never initial_suspend()
{
return {};
}
std::suspend_never final_suspend() noexcept
{
return {};
}
ExampleCoroutine get_return_object()
{
return {};
}
void return_void() {}
void unhandled_exception() {}
};
};
TEST(Foo, Bar)
{
[]() -> ExampleCoroutine
{
co_await std::suspend_never{};
ASSERT_EQ(true, false); // Compiler error here, due to return statement in macro
}();
}
My compiler is MSVC 19.33.31630.0
, error is error C3773: Use of 'return' in this context is a non-conforming extension in C++23
Is it possible to reopen this issue? (@gennadiycivil are you the right person to ping?)
3c5e064ca on clang-5.0 (libc++-5.0)
Given any awaitable object (in this example returned by
supplier()
),std::future<void>
for example.The concrete usage of
ASSERT_THROW
within a couroutine yields to an error when using clang: