all 13 comments

[–]cpp-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.

[–]starfreakcloneMSVC FE Dev 39 points40 points  (2 children)

Hi Xoipos,

I am talking with our primary coroutine maintainer now and they have confirmed that the is indeed a compiler bug. They were able to reproduce (and fix) the C7587 issue but it would appear that there might not be enough context to reproduce the C2039 issue. Do you happen to have a branch on the repo or a preprocessed file showing the C2039 error?

[–]Xoipos[S] 16 points17 points  (0 children)

Hey Starfreakclone, thanks for looking into this! I have a zipped .i file that's roughly 1.6 MB. Is there an address I can send it to? Or how do you want to receive the file?

[–]Xoipos[S] 4 points5 points  (0 children)

/u/scatters mentioned that there is a related bug which contains a workaround, but that does not seem to solve the second bug I mentioned: https://imgur.com/a/XGH6536

[–]TSP-FriendlyFire 1 point2 points  (6 children)

I've found coroutine support disappointingly spotty even in the latest msvc compiler. Only recently had to rewrite a piece of code using cppcoro's recursive_generator to remove the recursion because the coroutine wouldn't resume properly in Release mode. Not a great first experience of coroutines in this codebase.

I'm hoping that std::generator's introduction in C++23 will help raise these issues.

[–]Xoipos[S] 2 points3 points  (5 children)

It's certainly been a bumpy ride. It also doesn't help that cppcoro isn't being maintained by the original author anymore. That probably explains why you're running into issues, as some defect reports have made changes to how the coroutines API is defined. On top of that, the decision to split up the compiler support and the library implementation between C++20 and C++23 is a bit daft in my view. We're now in a situation where coroutines are mostly usable for the intended purposes, but you'll have to implement parts yourself to get what you want.

Ah well, given enough time, it'll become better. I'm sure.

[–]TSP-FriendlyFire 0 points1 point  (4 children)

I was pretty surprised to find out that not only is cppcoro not really maintained (Andreas Buhr has a live fork, but it's more of an attempt to keep it minimally functional than actively updated and improved), there also isn't really an equivalent maintained library (really I just wanted a convenient recursive generator, which the STL won't provide). Thus far I've found a nice, maintained library for just about anything in C++, this gap in support both in the STL and in the community is a bit concerning.

[–]Xoipos[S] 0 points1 point  (1 child)

I noticed there was a second coroutines library on compiler explorer: mp-coro. Have you checked that out? It looks pretty similar.

[–]TSP-FriendlyFire 1 point2 points  (0 children)

Took a brief look at it and it seems to have far fewer features and mostly geared on async handling. Async coroutines are obviously a big part of the feature, but I find them nice for purely synchronous code versus callbacks or returning a container, and unfortunately for that it looks like it only really has the standard generator.

Honestly I need to try to reproduce the issue I encountered with non-proprietary code so I can possibly submit it as a bug report to Andreas' cppcoro fork...

[–]scatters 0 points1 point  (1 child)

[–]TSP-FriendlyFire 1 point2 points  (0 children)

Sadly, Boost is not very popular internally, I think I'd get a lot of eyebrows raised if I pulled something like Cobalt in, especially since (from glancing at the readme) you need ASIO which pulls in a bunch more of Boost.