[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:26 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;
+  Iter iter2 = Iter();
+  assert(iter == iter2);
+}
+
+int main() {
----------------
ldionne wrote:

```suggestion
int main(int, char**) {
```

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


More information about the libcxx-commits mailing list