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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 9 06:16:24 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;
----------------
philnik777 wrote:

Why does this need to be cast to `const __map&`? Same below.

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


More information about the libcxx-commits mailing list