https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118074
--- Comment #2 from Weibo He <newsigma at 163 dot com> --- (In reply to Andrew Pinski from comment #1) > Is there a way to check to make sure you are not using the value after > deconstruction for MSVC too. Thank you for your comment @Andrew Pinski. We can take the address of return object and promise object. Duplicate codes are omitted here: https://godbolt.org/z/fW335zTdG ``` template<class T> struct CRCoro { void return_value(T&& x) noexcept { printf("%p\n", this); getDerived() = std::move(x); } }; int main() { A aa = func(); printf("%p\n", &aa); return 0; } ``` The output is: 00C985D0 007DFB98 5 The pointers point to different memory and we can conclude that we are not using the value after promise object deconstruction. > I am suspecting this is just undefined code. I am not quite sure if it is undefined. And I am wondering if it is reasonable to consider it as an extension if it indeed is. Please let me know if I might have made a mistake. Thanks again.