[libcxx-commits] [PATCH] D82627: Fix CFI issues in <future>

Brandon Tolsch via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 15 17:11:04 PDT 2020


btolsch marked an inline comment as done.
btolsch added a comment.

I don't think any of this is actually UB, for the same reason you stated.  What are the annotations that could be used instead of this change?



================
Comment at: libcxx/include/future:1966
         __f_ = (__base*)&__buf_;
-        __t->__move_to((__base*)&__f.__buf_);
+        __t->__move_to(&__f.__buf_);
         __t->destroy();
----------------
ldionne wrote:
> Can you please use `static_cast<__base*>(&__tempbuf)->__move_to(...)` here instead (and the same for the `destroy()` call)? I find it very confusing to have both `__t` and `__f_` interleaved, especially since the two letters look almost the same.
These can't be static_cast because the types aren't related.  It could be reinterpret_cast, but I left them as c-style casts to conform to surrounding code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82627/new/

https://reviews.llvm.org/D82627





More information about the libcxx-commits mailing list