[PATCH] D6974: [libcxx] Attempt to fix undefined behavior in list, forward_list and __tree.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 15 15:29:45 PDT 2016


EricWF abandoned this revision.
EricWF added a comment.

Abandoning. All issues have been addressed by other commits.


================
Comment at: include/memory:5452-5458
@@ +5451,9 @@
+  {
+    return static_cast<_To>(_FromPtrTraits::pointer_to(__e));
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  static _To __from_pointer(_From & __f)
+  {
+    return static_cast<_To>(__f);
+  }
----------------
rsmith wrote:
> It seems strange to use `static_cast` here and `reinterpret_cast` below. Even assuming the `reinterpret_cast` approach works, don't we still have the same problem if the user uses a fancy pointer type?
Yeah, I couldn't find a better way to convert fancy pointers. Perhaps we need to cast to a void pointer as a go between.


https://reviews.llvm.org/D6974





More information about the cfe-commits mailing list