[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
Fri Jun 1 15:36:21 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D47607#1118464, @EricWF wrote:

> One other concern I have is if there will be any performance impact to using `launder` all the time, but better safe than sorry.


In the short-to-medium term, I think we can tackle this by adding an attribute:

  // ...
  struct pair {
    T first;
    [[clang::not_actually_const]] U second;
  };

... to directly express that the `second` field of a non-const `pair` is never a const subobject, even if `U` is a `const`-qualified type. I think we'll need this once we head down the path of `constexpr` containers, otherwise `node_handle`s are not going to work in constant expression evaluation.

Then we can remove the `launder` calls for implementations that support the attribute.


https://reviews.llvm.org/D47607





More information about the cfe-commits mailing list