[libcxx-commits] [libcxx] 63ae509 - [libc++][test] Don't include `test_format_context.h` in `parse.pass.cpp` (#83734)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 11 07:55:20 PDT 2024
Author: A. Jiang
Date: 2024-03-11T10:55:16-04:00
New Revision: 63ae5099b7339e87e6ce67fc7da63d26b8e7cb27
URL: https://github.com/llvm/llvm-project/commit/63ae5099b7339e87e6ce67fc7da63d26b8e7cb27
DIFF: https://github.com/llvm/llvm-project/commit/63ae5099b7339e87e6ce67fc7da63d26b8e7cb27.diff
LOG: [libc++][test] Don't include `test_format_context.h` in `parse.pass.cpp` (#83734)
The `parse.pass.cpp` tests doen't need to call
`test_format_context_create` to create a `basic_format_context`, so they
shouldn't include `test_format_context.h`.
The `to_address` mechanism works around the iterator debugging
mechanisms of MSVC STL. Related to
[LWG3989](https://cplusplus.github.io/LWG/issue3989).
Discovered when implementing `formatter<tuple>` in MSVC STL. With the
inclusion removed, `std/utilities/format/format.tuple/parse.pass.cpp`
when using enhanced MSVC STL (and `/utf-8` option for MSVC).
Added:
Modified:
libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp
libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp
libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp
index 136910b90c909a..c47fb188c865c4 100644
--- a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/parse.pass.cpp
@@ -27,10 +27,10 @@
#include <cassert>
#include <concepts>
#include <format>
+#include <memory>
#include <queue>
#include <stack>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -44,7 +44,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class StringViewT>
diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp
index c761039442196f..abae40d78b23ac 100644
--- a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/parse.pass.cpp
@@ -25,9 +25,9 @@
#include <cassert>
#include <concepts>
#include <format>
+#include <memory>
#include <vector>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -41,7 +41,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class CharT>
diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp
index 8523bc89497174..2e75606832b435 100644
--- a/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp
+++ b/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/parse.pass.cpp
@@ -24,9 +24,9 @@
#include <cassert>
#include <concepts>
+#include <memory>
#include <thread>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -40,7 +40,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class CharT>
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
index efea2889ce3b5a..116f78e63be09e 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
@@ -22,6 +22,7 @@
#include <cassert>
#include <concepts>
#include <iterator>
+#include <memory>
#include <type_traits>
#include "test_format_context.h"
@@ -38,7 +39,8 @@ void test(StringT expected, StringViewT fmt, bool arg, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
StringT result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
index f363bc3032003c..3125dd8b60bbdc 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include <concepts>
#include <iterator>
+#include <memory>
#include <type_traits>
#include "test_format_context.h"
@@ -38,7 +39,8 @@ void test(StringT expected, StringViewT fmt, const CharT* a, std::size_t offset)
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
StringT result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp
index 554def930020a9..0723547c2df275 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp
@@ -22,6 +22,7 @@
#include <cassert>
#include <concepts>
#include <iterator>
+#include <memory>
#include <type_traits>
#include "test_format_context.h"
@@ -39,7 +40,8 @@ void test(StringT expected, StringViewT fmt, ArgumentT arg, std::size_t offset)
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
StringT result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp
index 295ba7f67bbc5b..b0ee399a1c191e 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include <concepts>
#include <iterator>
+#include <memory>
#include <type_traits>
#include "test_format_context.h"
@@ -51,7 +52,8 @@ struct Tester {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename std::basic_string_view<CharT>::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
std::basic_string<CharT> result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
index 6c507881167f77..263dc1d8d85180 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
@@ -34,6 +34,7 @@
#include <charconv>
#include <concepts>
#include <iterator>
+#include <memory>
#include <string>
#include <type_traits>
@@ -50,7 +51,8 @@ void test(std::basic_string_view<CharT> fmt, ArithmeticT arg, std::basic_string<
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename std::basic_string_view<CharT>::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
std::basic_string<CharT> result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
index e2b3d6b3d23701..5921cc6efcecbe 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
@@ -21,6 +21,7 @@
#include <charconv>
#include <concepts>
#include <iterator>
+#include <memory>
#include <string>
#include <type_traits>
@@ -43,7 +44,8 @@ void test(std::string expected, std::string_view fmt, color arg, std::size_t off
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename std::string_view::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
std::string result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
index aa10f34c95b796..408168e033bb6c 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
@@ -27,6 +27,7 @@
#include <charconv>
#include <concepts>
#include <iterator>
+#include <memory>
#include <string>
#include <type_traits>
@@ -44,7 +45,8 @@ void test(StringT expected, StringViewT fmt, PointerT arg, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
StringT result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp
index e5db5dac0c569d..cdd56d1b882a00 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp
@@ -30,6 +30,7 @@
#include <cassert>
#include <concepts>
#include <iterator>
+#include <memory>
#include <type_traits>
#include "test_format_context.h"
@@ -46,7 +47,8 @@ void test(StringT expected, StringViewT fmt, ArithmeticT arg, std::size_t offset
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
StringT result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
index 73df7464dcb7a7..49f54dae264787 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
@@ -23,6 +23,7 @@
#include <cassert>
#include <concepts>
#include <iterator>
+#include <memory>
#include <type_traits>
#include "make_string.h"
@@ -46,7 +47,8 @@ void test(StringT expected, StringViewT fmt, StringT a, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
StringT result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp
index eb70115bf5de59..a9537465faf9db 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp
@@ -30,6 +30,7 @@
#include <cassert>
#include <concepts>
#include <iterator>
+#include <memory>
#include <type_traits>
#include "test_format_context.h"
@@ -46,7 +47,8 @@ void test(StringT expected, StringViewT fmt, ArithmeticT arg, std::size_t offset
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
StringT result;
auto out = std::back_inserter(result);
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp
index 9f9b4d4545a892..0eb984cc2c01aa 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtdef/parse.pass.cpp
@@ -22,8 +22,8 @@
#include <cassert>
#include <concepts>
#include <format>
+#include <memory>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -37,7 +37,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class CharT>
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp
index daa92214845ba9..99d6aa7452a022 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtmap/parse.pass.cpp
@@ -25,8 +25,8 @@
#include <concepts>
#include <format>
#include <map>
+#include <memory>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -40,7 +40,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class CharT>
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp
index 843855f4e6d076..182beff4bd168f 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtset/parse.pass.cpp
@@ -24,9 +24,9 @@
#include <cassert>
#include <concepts>
#include <format>
+#include <memory>
#include <set>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -40,7 +40,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class CharT>
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp
index 7acee9cb9dc51a..3354de34721990 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtstr/parse.pass.cpp
@@ -23,9 +23,9 @@
#include <cassert>
#include <concepts>
#include <format>
+#include <memory>
#include "format.functions.tests.h"
-#include "test_format_context.h"
#include "test_macros.h"
template <class FormatterT, class StringViewT>
@@ -36,7 +36,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class StringViewT>
diff --git a/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp
index 87774c26208771..2d0cef11feb8c5 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.formatter/parse.pass.cpp
@@ -25,8 +25,8 @@
#include <cassert>
#include <concepts>
#include <format>
+#include <memory>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -40,7 +40,8 @@ constexpr void test_parse(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class CharT>
diff --git a/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp b/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp
index 5cabbda63dd02e..8653c282bfe107 100644
--- a/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.tuple/parse.pass.cpp
@@ -24,10 +24,10 @@
#include <cassert>
#include <concepts>
#include <format>
+#include <memory>
#include <tuple>
#include <utility>
-#include "test_format_context.h"
#include "test_macros.h"
#include "make_string.h"
@@ -41,7 +41,8 @@ constexpr void test(StringViewT fmt, std::size_t offset) {
static_assert(std::semiregular<decltype(formatter)>);
std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
- assert(it == fmt.end() - offset);
+ // std::to_address works around LWG3989 and MSVC STL's iterator debugging mechanism.
+ assert(std::to_address(it) == std::to_address(fmt.end()) - offset);
}
template <class CharT, class Arg>
More information about the libcxx-commits
mailing list