[libcxx-commits] [libcxx] [libc++] Always initialize __tree::{, const_}iterator (PR #147167)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 9 07:32:25 PDT 2025
================
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03
+
+// Check that map::iterator is initialized when default constructed
+
+#include <cassert>
+#include <map>
+
+template <class Iter>
+void test() {
+ Iter iter;
----------------
ldionne wrote:
While we're at it, let's test the following combinations:
```
{
Iter iter1, iter2;
assert(iter1 == iter2);
}
{
Iter iter1;
Iter iter2{};
assert(iter1 == iter2);
}
{
Iter iter1{};
Iter iter2;
assert(iter1 == iter2);
}
```
https://github.com/llvm/llvm-project/pull/147167
More information about the libcxx-commits
mailing list