不产生投掷的发电机 [英] generator that does not yield throws

查看:147
本文介绍了不产生投掷的发电机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近看到了回归,可能是在16 / 16.1(我们一直在使用15.9)VS编译器的C ++中,由于似乎是一个未定义的状态,生成器不会产生任何抛出。

we've seen a regression lately, possibly in the 16/16.1 (we've been using the 15.9) VS compiler for C++ that generators that does not yield anything throws due to what seems to be an undefined state.

生成器投掷代码非常多:

the generator throwing code is pretty much:

std :: experimental :: generator< std :: pair< SomeType,SomeType>> get()

std::experimental::generator<std::pair<SomeType, SomeType>> get()

{

  &NBSP;   while(在这种情况下,某些条款未评估为真){

     while (some clause that doesn't evaluate to true in this case){

  &NBSP; &NBSP; &NBSP; co_yield {some value,some value}

        co_yield {some value, some value }

  &NBSP; }

    }

  &NBSP; if(在这种情况下,某些其他条款没有评估为真){

    if (some other clause that doesn't evaluate to true in this case){

  &NBSP; &NBSP; &NBSP; co_yield {其他一些价值,其他一些价值}

        co_yield {some other value, some other value}

  &NBSP; }

    }

}

我们只在X86发布版本中看到崩溃。

we're seein the crash only in X86 release version.

我的代码中缺少什么?我看不到任何关于不允许生成器实际没有产生的文档。

is there something i'm missing with the code ? i couldn't see any documentation about not allowed to have generators that doesn't actually yield.

崩溃转储看起来像:

ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION}  Breakpoint  A breakpoint has been reached.

EXCEPTION_CODE: (HRESULT) 0x80000003 (2147483651) - One or more arguments are invalid

EXCEPTION_CODE_STR:  80000003

EXCEPTION_PARAMETER1:  00000000

EXCEPTION_PARAMETER2:  866cfd48

EXCEPTION_PARAMETER3:  00000000

01 068ff000 751c179c ntdll!NtWaitForSingleObject+0xc
02 068ff06c 75d8c533 KERNELBASE!WaitForSingleObjectEx+0x98
03 068ff084 75d8c4e2 kernel32!WaitForSingleObjectExImplementation+0x75
04 068ff098 014fa797 kernel32!WaitForSingleObject+0x12
05 068ff0b0 014fa023 google_breakpad::ExceptionHandler::WriteMinidumpOnHandlerThread+0x59 [D:\google-breakpad\src\client\windows\handler\exception_handler.cc @ 729] 
06 068ff0d0 75da0a26 google_breakpad::ExceptionHandler::HandleException+0x83 [D:\google-breakpad\src\client\windows\handler\exception_handler.cc @ 520] 
07 068ff158 774d2be5 kernel32!UnhandledExceptionFilter+0x127
08 068ff170 774d320c ntdll!TppExceptionFilter+0x59
09 068ff184 7749aedb ntdll!TppWorkerpInnerExceptionFilter+0x12
0a 068ff194 7741e55c ntdll!TppWorkerThread+0x57f
0b 068ff1a8 7741e3f4 ntdll!_EH4_CallFilterFunc+0x12
0c 068ff1d0 77446d09 ntdll!_except_handler4+0x8e
0d 068ff1f4 77446cdb ntdll!ExecuteHandler2+0x26
0e 068ff218 7741fbc7 ntdll!ExecuteHandler+0x24
0f 068ff2a4 77446b67 ntdll!RtlDispatchException+0x127
10 068ff2a4 015989f4 ntdll!KiUserExceptionDispatcher+0xf
11 068ff750 00f589f5 trigger::to_chunks$_ResumeCoro$2<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::pair<HKEY__ *,std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > > > > > >+0x284 [D:\jenkins\workspace\winagent-branch-build-fast\Location\RegistryChangeTrigger.cpp @ 25] 

推荐答案

感谢您在此发帖。

我模仿你的示例代码并在我的计算机上编写代码。该程序没有报告错误。供你参考,我的VS编译器版本是15.9.7。

I imitated your example code and write the code on my computer. The program did not report error. For your reference, my VS compiler version is 15.9.7.

>>我看不到任何关于不允许的文档生成器实际上没有产生。

正如你所说,我查阅了Microsoft文档和Stack Overflow论坛,发现与你的情况无关。在我看来,这个问题可能与您的代码有关,但它不是您列表中的一部分。 

As you said, I consulted the Microsoft document and Stack Overflow forum and found nothing relevant to your condition. In my opinion, this problem may be related to your code, but it's not the part of your list. 

如果可能的话,如果您能提供详细的步骤,我们将不胜感激。简单的演示,让我们重现您的问题。这样我们就可以轻松地为您提供帮助。 以下是与协同相关的链接。我希望这可以帮到你。

If possible, we would appreciate it if you could provide detailed steps or a simple demo for us to reproduce your issue. so that we could help you easily. Here are the link related to coroutine. I hope this can help you.

https:// stackoverflow.com/questions/43503656/what-are-coroutines-in-c20

最诚挚的问候,

Suarez Zhou

Suarez Zhou





这篇关于不产生投掷的发电机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆