[libcxx-commits] [libcxx] [libc++] Fix strict aliasing violation for `deque::const_iterator` (PR #136067)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 9 18:34:26 PDT 2026


================
@@ -725,24 +737,24 @@ public:
   // iterators:
 
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
-    __map_pointer __mp = __map_.begin() + __start_ / __block_size;
+    auto __mp = static_cast<const __map&>(__map_).begin() + __start_ / __block_size;
----------------
frederick-vs-ja wrote:

I wanted to ensure calling the `const` overload of `__split_buffer::begin/end`. But given implicit conversion should work, I'll remove the cast.

https://github.com/llvm/llvm-project/pull/136067


More information about the libcxx-commits mailing list