Skip to content

Commit

Permalink
Fix recursive generator in msvc (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasbuhr authored Jul 13, 2022
1 parent 166688c commit 9c333f9
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions test/recursive_generator_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,6 @@ TEST_CASE("exception thrown from recursive call can be caught by caller")

TEST_CASE("exceptions thrown from nested call can be caught by caller")
{
#if _MSC_VER >= 1929 && _MSVC_LANG == 202002L
/*
* Crashes. Known bug, reported in
* https://github.com/andreasbuhr/cppcoro/issues/53
* and
* https://developercommunity.visualstudio.com/t/MSVC-generates-segfaulting-code-for-coro/10074712
*/
return;
#endif

class SomeException : public std::exception {};

auto f = [](std::uint32_t depth, auto&& f) -> recursive_generator<std::uint32_t>
Expand All @@ -271,7 +261,8 @@ TEST_CASE("exceptions thrown from nested call can be caught by caller")

try
{
co_yield f(4, f);
auto next_generator = f(4, f);
co_yield next_generator;
}
catch (SomeException)
{
Expand All @@ -286,7 +277,8 @@ TEST_CASE("exceptions thrown from nested call can be caught by caller")
bool caught = false;
try
{
co_yield f(3, f);
auto next_generator = f(3, f);
co_yield next_generator;
}
catch (SomeException)
{
Expand All @@ -301,8 +293,10 @@ TEST_CASE("exceptions thrown from nested call can be caught by caller")
else
{
co_yield 1;
co_yield f(2, f);
co_yield f(3, f);
auto next_generator = f(2, f);
co_yield next_generator;
auto next_generator2 = f(3, f);
co_yield next_generator2;
}
};

Expand Down

0 comments on commit 9c333f9

Please sign in to comment.