landelare / ue5coro

A C++20 coroutine implementation for Unreal Engine 5 that feels almost native.
BSD 3-Clause Clear License
543 stars 48 forks source link

Undefined behaviour #2

Closed kelbon closed 2 years ago

kelbon commented 2 years ago

https://github.com/landelare/ue5coro/blob/ec6f8c644cd46ad6ff0cdd2fc68d068dd3fd2d0f/Source/UE5Coro/Public/UE5Coro/Generator.h#L190

co_yield float{} in generator ==> your promise saves pointer to float value in void, so next step .Current() returns reference to int, but float under it! And dont use static cast with void please!

landelare commented 2 years ago

Thank you for the bug report, it will be fixed in 1.2. What's wrong with static_cast?