[PATCH] D47607: [libcxx] Almost fix some UB in <map> and <unordered_map>

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 31 18:28:42 PDT 2018


rsmith added inline comments.


================
Comment at: libcxx/include/map:617
 template <class _Key, class _Tp>
 union __value_type
 {
----------------
This doesn't need to be a union any more; change to class?


================
Comment at: libcxx/include/map:633
+#if _LIBCPP_STD_VER > 14
+        return _VSTD::launder(this)->__cc;
+#else
----------------
Formally this should be `return *_VSTD::launder(&this->__cc);`, because `this` must already point to an in-lifetime object or the member function call would have been invalid.


Repository:
  rCXX libc++

https://reviews.llvm.org/D47607





More information about the cfe-commits mailing list