From 683ef99699e3b5f5ed06279627d1e332f41a84eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 01:25:15 +0100 Subject: [PATCH 01/31] Test that selected headers introduce machinery from iterator.range/1 --- tests/std/test.lst | 1 + .../__init__.py | 2 + .../custom_format.py | 27 ++++++ .../env.lst | 4 + .../lit.local.cfg | 9 ++ .../shared_test.hpp | 84 +++++++++++++++++++ .../test.cpp | 52 ++++++++++++ .../test_array.cpp | 11 +++ .../test_deque.cpp | 11 +++ .../test_flat_map.cpp | 29 +++++++ .../test_flat_set.cpp | 23 +++++ .../test_forward_list.cpp | 11 +++ .../test_list.cpp | 11 +++ .../test_map.cpp | 20 +++++ .../test_optional.cpp | 22 +++++ .../test_regex.cpp | 11 +++ .../test_set.cpp | 14 ++++ .../test_span.cpp | 20 +++++ .../test_stacktrace.cpp | 20 +++++ .../test_string.cpp | 11 +++ .../test_string_view.cpp | 20 +++++ .../test_unordered_map.cpp | 20 +++++ .../test_unordered_set.cpp | 14 ++++ .../test_valarray.cpp | 13 +++ .../test_vector.cpp | 11 +++ 25 files changed, 471 insertions(+) create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/__init__.py create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/custom_format.py create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/env.lst create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/lit.local.cfg create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_array.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_deque.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_forward_list.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_list.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_map.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_regex.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_set.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_stacktrace.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string_view.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_map.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_set.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_valarray.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_vector.cpp diff --git a/tests/std/test.lst b/tests/std/test.lst index c44a4197217..e5c34a85fdb 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -290,6 +290,7 @@ tests\LWG3528_make_from_tuple_impl tests\LWG3545_pointer_traits_sfinae tests\LWG3561_discard_block_engine_counter tests\LWG3610_iota_view_size_and_integer_class +tests\LWG3987_including_flat_foo_doesnt_provide_begin_end tests\LWG4084_iostream_uppercase_inf_nan tests\LWG4105_ranges_ends_with_and_integer_class tests\LWG4172_unique_lock_self_move_assignment diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/__init__.py b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/__init__.py new file mode 100644 index 00000000000..2ac2a854cb0 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/__init__.py @@ -0,0 +1,2 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/custom_format.py b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/custom_format.py new file mode 100644 index 00000000000..2d698f717b2 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/custom_format.py @@ -0,0 +1,27 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +import os + +from stl.test.format import STLTestFormat, TestStep +from stl.test.tests import TestType + + +class CustomTestFormat(STLTestFormat): + def getBuildSteps(self, test, litConfig, shared): + exeSourceDir = os.path.dirname(test.getSourcePath()) + _, outputBase = test.getTempPaths() + + sourceFiles = [] + for filename in os.listdir(exeSourceDir): + if filename.endswith('.cpp'): + sourceFiles.append(os.path.join(exeSourceDir, filename)) + + if TestType.COMPILE in test.testType: + cmd = [test.cxx, '/c', *sourceFiles, *test.flags, *test.compileFlags] + elif TestType.RUN in test.testType: + shared.execFile = outputBase + '.exe' + cmd = [test.cxx, *sourceFiles, *test.flags, *test.compileFlags, '/Fe' + shared.execFile, + '/link', *test.linkFlags] + + yield TestStep(cmd, shared.execDir, shared.env, False) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/env.lst b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/env.lst new file mode 100644 index 00000000000..19f025bd0e6 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/env.lst @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +RUNALL_INCLUDE ..\usual_matrix.lst diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/lit.local.cfg b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/lit.local.cfg new file mode 100644 index 00000000000..5c91ec58b81 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/lit.local.cfg @@ -0,0 +1,9 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +import os +import site +site.addsitedir(os.path.dirname(os.path.dirname(__file__))) +import LWG3987_including_flat_foo_doesnt_provide_begin_end.custom_format + +config.test_format = LWG3987_including_flat_foo_doesnt_provide_begin_end.custom_format.CustomTestFormat() diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp new file mode 100644 index 00000000000..80ff705ac39 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +// Intentionally avoid including anything, relevant headers are included in .cpp files. +// Test requirements of N5014 [iterator.range]/1 +// LWG-3987 added headers + +namespace detail { + + // Define minimal metaprogramming tools, avoid including anything + +#define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ + template \ + struct conditional_caller_of_##member_name { \ + void operator()(T& t) { \ + (void) t; \ + } \ + }; \ + \ + template \ + struct conditional_caller_of_##member_name(nullptr)->member_name())> { \ + void operator()(T& t) { \ + t.member_name(); \ + } \ + }; + +#define CONDITIONALLY_CALL(c, member_name) conditional_caller_of_##member_name{}(c) + + DEFINE_CONDITIONAL_CALLER_OF(rbegin); + DEFINE_CONDITIONAL_CALLER_OF(rend); + DEFINE_CONDITIONAL_CALLER_OF(crbegin); + DEFINE_CONDITIONAL_CALLER_OF(crend); + DEFINE_CONDITIONAL_CALLER_OF(size); + DEFINE_CONDITIONAL_CALLER_OF(ssize); + DEFINE_CONDITIONAL_CALLER_OF(empty); + DEFINE_CONDITIONAL_CALLER_OF(data); + + + template + void test_free_container_functions(C& c) { + (void) begin(c); + (void) end(c); + (void) cbegin(c); + (void) cend(c); + CONDITIONALLY_CALL(c, rbegin); // missing e.g. for forward_list + CONDITIONALLY_CALL(c, rend); // missing e.g. for forward_list + CONDITIONALLY_CALL(c, crbegin); // missing e.g. for forward_list + CONDITIONALLY_CALL(c, crend); // missing e.g. for forward_list + CONDITIONALLY_CALL(c, size); // missing e.g. for optional + CONDITIONALLY_CALL(c, ssize); // missing e.g. for optional + CONDITIONALLY_CALL(c, empty); // missing e.g. for valarray + CONDITIONALLY_CALL(c, data); // missing e.g. for valarray + } + + inline void test_free_array_functions() { + using namespace std; + + int a[]{1, 2, 3}; + + (void) begin(a); + (void) end(a); + (void) cbegin(a); + (void) cend(a); + (void) rbegin(a); + (void) rend(a); + (void) crbegin(a); + (void) crend(a); + (void) size(a); +#if _HAS_CXX20 + (void) ssize(a); +#endif + (void) empty(a); + (void) data(a); + } +} // namespace detail + +template +void shared_test(C& c) { + detail::test_free_container_functions(c); + // as_const from not required to be available + detail::test_free_container_functions(const_cast(c)); + + detail::test_free_array_functions(); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp new file mode 100644 index 00000000000..3520aca47bc --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +void test_array(); +void test_deque(); +void test_flat_map(); +void test_flat_set(); +void test_forward_list(); +#if 0 // TRANSITION, _HAS_CXX26 +void test_hive(); +void test_inplace_vector(); +#endif // _HAS_CXX26 +void test_list(); +void test_map(); +void test_optional(); +void test_regex(); +void test_set(); +void test_span(); +void test_stacktrace(); +void test_string(); +void test_string_view(); +void test_unordered_map(); +void test_unordered_set(); +void test_valarray(); +void test_vector(); + +int main() { + test_array(); + test_deque(); + test_flat_map(); + test_flat_set(); + test_forward_list(); +#if 0 // TRANSITION, _HAS_CXX26 + test_hive(); + test_inplace_vector(); +#endif // _HAS_CXX26 + test_list(); + test_map(); + test_optional(); + test_regex(); + test_set(); + test_span(); + test_stacktrace(); + test_string(); + test_string_view(); + test_unordered_map(); + test_unordered_set(); + test_valarray(); + test_vector(); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_array.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_array.cpp new file mode 100644 index 00000000000..f2422e0efa8 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_array.cpp @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_array() { + std::array container{1, 2, 3}; + shared_test(container); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_deque.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_deque.cpp new file mode 100644 index 00000000000..3cb47d630d6 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_deque.cpp @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_deque() { + std::deque container{1, 2, 3}; + shared_test(container); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp new file mode 100644 index 00000000000..8d384935b8d --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#ifdef __cpp_lib_flat_map + +#include + +#include "shared_test.hpp" + +void test_flat_map() { + std::flat_map container{ + {1, 5}, + {3, 7}, + }; + shared_test(container); + + std::flat_multimap container2{ + {1, 5}, + {3, 7}, + }; + shared_test(container2); +} + +#else // ^^^ defined(__cpp_lib_flat_map) / ! defined(__cpp_lib_flat_map) vvv + +void test_flat_map() {} + +#endif // ! defined(__cpp_lib_flat_map) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp new file mode 100644 index 00000000000..4056d1f1b79 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#ifdef __cpp_lib_flat_set + +#include + +#include "shared_test.hpp" + +void test_flat_set() { + std::flat_set container{1, 2, 3}; + shared_test(container); + + std::flat_multiset container2{1, 2, 3}; + shared_test(container2); +} + +#else // ^^^ defined(__cpp_lib_flat_set) / ! defined(__cpp_lib_flat_set) vvv + +void test_flat_set() {} + +#endif // ! defined(__cpp_lib_flat_set) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_forward_list.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_forward_list.cpp new file mode 100644 index 00000000000..85421feb199 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_forward_list.cpp @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_forward_list() { + std::forward_list container{1, 2, 3}; + shared_test(container); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_list.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_list.cpp new file mode 100644 index 00000000000..265e676721b --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_list.cpp @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_list() { + std::list container{1, 2, 3}; + shared_test(container); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_map.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_map.cpp new file mode 100644 index 00000000000..069df2ebbfd --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_map.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_map() { + std::map container{ + {1, 2}, + {3, 4} + }; + shared_test(container); + + std::multimap container2{ + {5, 2}, + {6, 4} + }; + shared_test(container2); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp new file mode 100644 index 00000000000..720dabe55ab --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#if _HAS_CXX17 + +#include + +#include "shared_test.hpp" + +void test_optional() { +#if 0 // TRANSITION, _HAS_CXX26, depends on fixing GH-4772 + std::optional container{1}; + shared_test(container); +#endif // _HAS_CXX26 +} + +#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv + +void test_optional() {} + +#endif // !_HAS_CXX17 \ No newline at end of file diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_regex.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_regex.cpp new file mode 100644 index 00000000000..27f688c0726 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_regex.cpp @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_regex() { + std::smatch container; + shared_test(container); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_set.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_set.cpp new file mode 100644 index 00000000000..a48944e789c --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_set.cpp @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_set() { + std::set container{1,2,3}; + shared_test(container); + + std::multiset container2{1,2,3}; + shared_test(container2); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp new file mode 100644 index 00000000000..d865137e8e1 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#if _HAS_CXX20 +#include + +#include "shared_test.hpp" + +void test_span() { + int array[]{1, 2, 3}; + std::span container(array); + shared_test(container); +} + +#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv + +void test_span() {} + +#endif // !_HAS_CXX20 diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_stacktrace.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_stacktrace.cpp new file mode 100644 index 00000000000..0b9bfdcde64 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_stacktrace.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#if _HAS_CXX23 + +#include + +#include "shared_test.hpp" + +void test_stacktrace() { + std::stacktrace container; + shared_test(container); +} + +#else // ^^^ _HAS_CXX23 / !_HAS_CXX23 vvv + +void test_stacktrace() {} + +#endif // !_HAS_CXX23 diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string.cpp new file mode 100644 index 00000000000..2957f1ecf71 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string.cpp @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_string() { + std::string container = "hello"; + shared_test(container); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string_view.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string_view.cpp new file mode 100644 index 00000000000..df5866b094c --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string_view.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#if _HAS_CXX17 + +#include + +#include "shared_test.hpp" + +void test_string_view() { + char text[] = "hello"; + std::string_view container = text; + shared_test(container); +} +#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv + +void test_string_view() {} + +#endif // !_HAS_CXX17 diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_map.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_map.cpp new file mode 100644 index 00000000000..f4c95af8cce --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_map.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_unordered_map() { + std::unordered_map container{ + {1, 2}, + {3, 4} + }; + shared_test(container); + + std::unordered_multimap container2{ + {5, 2}, + {6, 4} + }; + shared_test(container2); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_set.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_set.cpp new file mode 100644 index 00000000000..ecff1e93622 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_set.cpp @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_unordered_set() { + std::unordered_set container{1,2,3}; + shared_test(container); + + std::unordered_multiset container2{4,5,6}; + shared_test(container2); +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_valarray.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_valarray.cpp new file mode 100644 index 00000000000..847fb51ec30 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_valarray.cpp @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_valarray() { +#if 0 // TRANSITION, fails at the moment, fixed by not-yet accepted GH-5847 + std::valarray container{1, 2, 3}; + shared_test(container); +#endif +} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_vector.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_vector.cpp new file mode 100644 index 00000000000..942dcef972b --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_vector.cpp @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +void test_vector() { + std::vector container{1, 2, 3}; + shared_test(container); +} From c7c049002ecd4ebee5a06bf9c65a858a181f7b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 01:44:06 +0100 Subject: [PATCH 02/31] Properly guard the test of introduction of begin/end by by feature test macro. --- .../test_optional.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp index 720dabe55ab..a4bd81d3143 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp @@ -9,10 +9,10 @@ #include "shared_test.hpp" void test_optional() { -#if 0 // TRANSITION, _HAS_CXX26, depends on fixing GH-4772 +#ifdef __cpp_lib_optional_range_support std::optional container{1}; shared_test(container); -#endif // _HAS_CXX26 +#endif // defined(__cpp_lib_optional_range_support) } #else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv From 0d52345d472c4e37a6e9f4af5eb6aaf9f1b4a5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 01:53:51 +0100 Subject: [PATCH 03/31] Add tests for hive and inplace_vector. --- .../test.cpp | 4 ---- .../test_hive.cpp | 20 +++++++++++++++++++ .../test_inplace_vector.cpp | 20 +++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp index 3520aca47bc..d5233d1ca57 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp @@ -8,10 +8,8 @@ void test_deque(); void test_flat_map(); void test_flat_set(); void test_forward_list(); -#if 0 // TRANSITION, _HAS_CXX26 void test_hive(); void test_inplace_vector(); -#endif // _HAS_CXX26 void test_list(); void test_map(); void test_optional(); @@ -32,10 +30,8 @@ int main() { test_flat_map(); test_flat_set(); test_forward_list(); -#if 0 // TRANSITION, _HAS_CXX26 test_hive(); test_inplace_vector(); -#endif // _HAS_CXX26 test_list(); test_map(); test_optional(); diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp new file mode 100644 index 00000000000..f37adc26293 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#if __has_include() + +#include + +#include "shared_test.hpp" + +void test_hive() { + std::hive container{1, 2, 3}; + shared_test(container); +} + +#else // ^^^ __has_include() / !__has_include() vvv + +void test_hive() {} + +#endif // !__has_include() \ No newline at end of file diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp new file mode 100644 index 00000000000..78ccd0780cc --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#if __has_include() + +#include + +#include "shared_test.hpp" + +void test_inplace_vector() { + std::inplace_vector container{1, 2, 3}; + shared_test(container); +} + +#else // ^^^ __has_include() / !__has_include() vvv + +void test_inplace_vector() {} + +#endif // !__has_include() \ No newline at end of file From 3e325580e94c15835f74cb19b97692e784167b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 02:02:23 +0100 Subject: [PATCH 04/31] Use feature test macro instead of __has_include. --- .../test_flat_map.cpp | 2 +- .../test_flat_set.cpp | 2 +- .../test_hive.cpp | 6 +++--- .../test_inplace_vector.cpp | 6 +++--- .../test_optional.cpp | 8 +++----- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp index 8d384935b8d..46512a7e28f 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#ifdef __cpp_lib_flat_map +#if defined(__cpp_lib_flat_map) #include diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp index 4056d1f1b79..b3dd15318fb 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#ifdef __cpp_lib_flat_set +#if defined(__cpp_lib_flat_set) #include diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp index f37adc26293..46f0351d84d 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if __has_include() +#if defined(__cpp_lib_hive) #include @@ -13,8 +13,8 @@ void test_hive() { shared_test(container); } -#else // ^^^ __has_include() / !__has_include() vvv +#else // ^^^ defined(__cpp_lib_hive) / !defined(__cpp_lib_hive) vvv void test_hive() {} -#endif // !__has_include() \ No newline at end of file +#endif // !defined(__cpp_lib_hive) \ No newline at end of file diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp index 78ccd0780cc..a0c97898144 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if __has_include() +#if defined(__cpp_lib_inplace_vector) #include @@ -13,8 +13,8 @@ void test_inplace_vector() { shared_test(container); } -#else // ^^^ __has_include() / !__has_include() vvv +#else // ^^^ defined(__cpp_lib_inplace_vector) / ! defined(__cpp_lib_inplace_vector) vvv void test_inplace_vector() {} -#endif // !__has_include() \ No newline at end of file +#endif // ! defined(__cpp_lib_inplace_vector) \ No newline at end of file diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp index a4bd81d3143..58d7407bfed 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp @@ -2,21 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if _HAS_CXX17 +#if defined(__cpp_lib_optional_range_support) #include #include "shared_test.hpp" void test_optional() { -#ifdef __cpp_lib_optional_range_support std::optional container{1}; shared_test(container); -#endif // defined(__cpp_lib_optional_range_support) } -#else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv +#else // ^^^ defined(__cpp_lib_optional_range_support) / ! defined(__cpp_lib_optional_range_support) vvv void test_optional() {} -#endif // !_HAS_CXX17 \ No newline at end of file +#endif // ! defined(__cpp_lib_optional_range_support) \ No newline at end of file From a48d2e0520205bfd537d8f5dd8156aa52d5d8304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 02:17:29 +0100 Subject: [PATCH 05/31] Properly guard tests for C++23 and C++26 feature with feature test macros and _HAS_CXX2a --- .../test_flat_map.cpp | 6 +++--- .../test_flat_set.cpp | 6 +++--- .../test_hive.cpp | 6 +++--- .../test_inplace_vector.cpp | 6 +++--- .../test_optional.cpp | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp index 46512a7e28f..0de4ccd1b72 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_flat_map) +#if defined(__cpp_lib_flat_map) && _HAS_CXX23 #include @@ -22,8 +22,8 @@ void test_flat_map() { shared_test(container2); } -#else // ^^^ defined(__cpp_lib_flat_map) / ! defined(__cpp_lib_flat_map) vvv +#else // ^^^ defined(__cpp_lib_flat_map) && _HAS_CXX23 / feature not available vvv void test_flat_map() {} -#endif // ! defined(__cpp_lib_flat_map) +#endif // feature not available diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp index b3dd15318fb..7f0a242e949 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_flat_set) +#if defined(__cpp_lib_flat_set ) && _HAS_CXX23 #include @@ -16,8 +16,8 @@ void test_flat_set() { shared_test(container2); } -#else // ^^^ defined(__cpp_lib_flat_set) / ! defined(__cpp_lib_flat_set) vvv +#else // ^^^ defined(__cpp_lib_flat_set) && _HAS_CXX23 / feature not available vvv void test_flat_set() {} -#endif // ! defined(__cpp_lib_flat_set) +#endif // feature not available diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp index 46f0351d84d..2f49603fa9e 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_hive) +#if defined(__cpp_lib_hive) && _HAS_CXX26 #include @@ -13,8 +13,8 @@ void test_hive() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_hive) / !defined(__cpp_lib_hive) vvv +#else // ^^^ defined(__cpp_lib_hive) && _HAS_CXX26 / feature not available vvv void test_hive() {} -#endif // !defined(__cpp_lib_hive) \ No newline at end of file +#endif // feature not available \ No newline at end of file diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp index a0c97898144..f6a573c5e7d 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_inplace_vector) +#if defined(__cpp_lib_inplace_vector) && _HAS_CXX26 #include @@ -13,8 +13,8 @@ void test_inplace_vector() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_inplace_vector) / ! defined(__cpp_lib_inplace_vector) vvv +#else // ^^^ defined(__cpp_lib_inplace_vector) && _HAS_CXX26 / feature not available vvv void test_inplace_vector() {} -#endif // ! defined(__cpp_lib_inplace_vector) \ No newline at end of file +#endif // feature not available \ No newline at end of file diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp index 58d7407bfed..46be33d3b28 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_optional_range_support) +#if defined(__cpp_lib_optional_range_support) && _HAS_CXX17 #include @@ -13,8 +13,8 @@ void test_optional() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_optional_range_support) / ! defined(__cpp_lib_optional_range_support) vvv +#else // ^^^ defined(__cpp_lib_optional_range_support) && _HAS_CXX17 / feature not available vvv void test_optional() {} -#endif // ! defined(__cpp_lib_optional_range_support) \ No newline at end of file +#endif // feature not available \ No newline at end of file From 8c9246071e5e26a6e4037124911d46360869e31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 13:04:20 +0100 Subject: [PATCH 06/31] Properly test the free functions, not member functions. --- .../shared_test.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp index 80ff705ac39..6a6701b5dc5 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp @@ -7,6 +7,9 @@ namespace detail { + // file test_iterator.cpp uses a non-std container and thus we can't rely on ADL to find begin/end etc. + using namespace std; + // Define minimal metaprogramming tools, avoid including anything #define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ @@ -20,7 +23,7 @@ namespace detail { template \ struct conditional_caller_of_##member_name(nullptr)->member_name())> { \ void operator()(T& t) { \ - t.member_name(); \ + (void) member_name(t); \ } \ }; @@ -53,8 +56,6 @@ namespace detail { } inline void test_free_array_functions() { - using namespace std; - int a[]{1, 2, 3}; (void) begin(a); From 53454ae890c57aa972a4b63a690f5427c41dd949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 13:05:27 +0100 Subject: [PATCH 07/31] Use only feature test macros, do not duplicate the check with _HAS_CXX2a --- .../test.cpp | 2 -- .../test_flat_map.cpp | 4 ++-- .../test_flat_set.cpp | 4 ++-- .../test_hive.cpp | 4 ++-- .../test_inplace_vector.cpp | 4 ++-- .../test_optional.cpp | 4 ++-- .../test_span.cpp | 1 + 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp index d5233d1ca57..26c280b2d76 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include - void test_array(); void test_deque(); void test_flat_map(); diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp index 0de4ccd1b72..21d2aa820d4 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_flat_map) && _HAS_CXX23 +#if defined(__cpp_lib_flat_map) #include @@ -22,7 +22,7 @@ void test_flat_map() { shared_test(container2); } -#else // ^^^ defined(__cpp_lib_flat_map) && _HAS_CXX23 / feature not available vvv +#else // ^^^ defined(__cpp_lib_flat_map) / feature not available vvv void test_flat_map() {} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp index 7f0a242e949..19e23502704 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_flat_set ) && _HAS_CXX23 +#if defined(__cpp_lib_flat_set ) #include @@ -16,7 +16,7 @@ void test_flat_set() { shared_test(container2); } -#else // ^^^ defined(__cpp_lib_flat_set) && _HAS_CXX23 / feature not available vvv +#else // ^^^ defined(__cpp_lib_flat_set) / feature not available vvv void test_flat_set() {} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp index 2f49603fa9e..f8e55358019 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_hive) && _HAS_CXX26 +#if defined(__cpp_lib_hive) #include @@ -13,7 +13,7 @@ void test_hive() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_hive) && _HAS_CXX26 / feature not available vvv +#else // ^^^ defined(__cpp_lib_hive) / feature not available vvv void test_hive() {} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp index f6a573c5e7d..e46c2c5c450 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_inplace_vector) && _HAS_CXX26 +#if defined(__cpp_lib_inplace_vector) #include @@ -13,7 +13,7 @@ void test_inplace_vector() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_inplace_vector) && _HAS_CXX26 / feature not available vvv +#else // ^^^ defined(__cpp_lib_inplace_vector) / feature not available vvv void test_inplace_vector() {} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp index 46be33d3b28..9b19aeb600f 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_optional_range_support) && _HAS_CXX17 +#if defined(__cpp_lib_optional_range_support) #include @@ -13,7 +13,7 @@ void test_optional() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_optional_range_support) && _HAS_CXX17 / feature not available vvv +#else // ^^^ defined(__cpp_lib_optional_range_support) / feature not available vvv void test_optional() {} diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp index d865137e8e1..4cb1fc26b2d 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp @@ -3,6 +3,7 @@ #include #if _HAS_CXX20 + #include #include "shared_test.hpp" From dc2cd249998be353689d44d61b192e227d386672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 19 Dec 2025 13:06:31 +0100 Subject: [PATCH 08/31] Add test for --- .../test.cpp | 2 ++ .../test_literator.cpp | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp index 26c280b2d76..96e52373adc 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp @@ -8,6 +8,7 @@ void test_flat_set(); void test_forward_list(); void test_hive(); void test_inplace_vector(); +void test_iterator(); void test_list(); void test_map(); void test_optional(); @@ -30,6 +31,7 @@ int main() { test_forward_list(); test_hive(); test_inplace_vector(); + test_iterator(); test_list(); test_map(); test_optional(); diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp new file mode 100644 index 00000000000..93546e4a9b4 --- /dev/null +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include + +#include "shared_test.hpp" + +struct minimal_container { + void begin() const {} + void end() const {} + void cbegin() const {} + void cend() const {} + void crbegin() const {} + void crend() const {} + void rbegin() const {} + void rend() const {} + void size() const {} + void ssize() const {} + void empty() const {} + void data() const {} +}; + +void test_iterator() { + minimal_container container; + shared_test(container); +} From 5b12d0761c00e9a28c9108b316a7945ab14ab3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Sat, 3 Jan 2026 23:08:23 +0100 Subject: [PATCH 09/31] Fix template utility detecting presence of a member function in containers. --- .../shared_test.hpp | 26 +++++++++---------- .../test_literator.cpp | 5 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp index 6a6701b5dc5..d17a4c6ec5b 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp @@ -12,19 +12,19 @@ namespace detail { // Define minimal metaprogramming tools, avoid including anything -#define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ - template \ - struct conditional_caller_of_##member_name { \ - void operator()(T& t) { \ - (void) t; \ - } \ - }; \ - \ - template \ - struct conditional_caller_of_##member_name(nullptr)->member_name())> { \ - void operator()(T& t) { \ - (void) member_name(t); \ - } \ +#define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ + template \ + struct conditional_caller_of_##member_name { \ + void operator()(T& t) { \ + (void) t; \ + } \ + }; \ + \ + template \ + struct conditional_caller_of_##member_name(nullptr)->member_name())> { \ + void operator()(T& t) { \ + (void) member_name(t); \ + } \ }; #define CONDITIONALLY_CALL(c, member_name) conditional_caller_of_##member_name{}(c) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp index 93546e4a9b4..81ddd694696 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp @@ -14,8 +14,9 @@ struct minimal_container { void crend() const {} void rbegin() const {} void rend() const {} - void size() const {} - void ssize() const {} + size_t size() const { + return 0; + } void empty() const {} void data() const {} }; From dabbeaaccf59a45cc159abab7f69ce9aa2568610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Sat, 3 Jan 2026 23:43:16 +0100 Subject: [PATCH 10/31] Self test detection mechanism. --- .../shared_test.hpp | 6 +-- .../test_literator.cpp | 41 +++++++++++++------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp index d17a4c6ec5b..fd6ce8d9353 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp @@ -15,15 +15,15 @@ namespace detail { #define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ template \ struct conditional_caller_of_##member_name { \ - void operator()(T& t) { \ + constexpr void operator()(T& t) { \ (void) t; \ } \ }; \ \ template \ struct conditional_caller_of_##member_name(nullptr)->member_name())> { \ - void operator()(T& t) { \ - (void) member_name(t); \ + constexpr auto operator()(T& t) { \ + return member_name(t); \ } \ }; diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp index 81ddd694696..6a535702bc5 100644 --- a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp +++ b/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp @@ -6,22 +6,39 @@ #include "shared_test.hpp" struct minimal_container { - void begin() const {} - void end() const {} - void cbegin() const {} - void cend() const {} - void crbegin() const {} - void crend() const {} - void rbegin() const {} - void rend() const {} - size_t size() const { - return 0; + static constexpr size_t magic_value = 3376942; + + constexpr void begin() const {} + constexpr void end() const {} + constexpr void cbegin() const {} + constexpr void cend() const {} + constexpr void crbegin() const {} + constexpr void crend() const {} + constexpr void rbegin() const {} + constexpr void rend() const {} + constexpr size_t size() const { + return magic_value; } - void empty() const {} - void data() const {} + constexpr void empty() const {} + constexpr void data() const {} }; + +// Self-test the template machinery to check it properly detects member functions +namespace detail { + template + constexpr bool minimal_container_test(C& c) { + // when the CONDITIONALLY_CALL expression fails to detect the member, it has type voi, i.e. clearly + // incompatible with operator==. If the detection mechanism did not work properly, this would fail to compile. + return CONDITIONALLY_CALL(c, size) == minimal_container::magic_value; + } + + constexpr minimal_container min_cont; + static_assert(minimal_container_test(min_cont), "The member detection utility is broken"); +} // namespace detail + void test_iterator() { minimal_container container; + shared_test(container); } From d13eb55742f968d56d5873b5e69a7480a59898ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Sat, 3 Jan 2026 23:48:46 +0100 Subject: [PATCH 11/31] Rename new tests to mention this GH PR. --- .../__init__.py | 0 .../custom_format.py | 0 .../env.lst | 0 .../lit.local.cfg | 0 .../shared_test.hpp | 0 .../test.cpp | 0 .../test_array.cpp | 0 .../test_deque.cpp | 0 .../test_flat_map.cpp | 0 .../test_flat_set.cpp | 0 .../test_forward_list.cpp | 0 .../test_hive.cpp | 0 .../test_inplace_vector.cpp | 0 .../test_list.cpp | 0 .../test_literator.cpp | 0 .../test_map.cpp | 0 .../test_optional.cpp | 0 .../test_regex.cpp | 0 .../test_set.cpp | 0 .../test_span.cpp | 0 .../test_stacktrace.cpp | 0 .../test_string.cpp | 0 .../test_string_view.cpp | 0 .../test_unordered_map.cpp | 0 .../test_unordered_set.cpp | 0 .../test_valarray.cpp | 0 .../test_vector.cpp | 0 27 files changed, 0 insertions(+), 0 deletions(-) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/__init__.py (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/custom_format.py (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/env.lst (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/lit.local.cfg (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/shared_test.hpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_array.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_deque.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_flat_map.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_flat_set.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_forward_list.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_hive.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_inplace_vector.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_list.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_literator.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_map.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_optional.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_regex.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_set.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_span.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_stacktrace.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_string.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_string_view.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_unordered_map.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_unordered_set.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_valarray.cpp (100%) rename tests/std/tests/{LWG3987_including_flat_foo_doesnt_provide_begin_end => GH_005968_headers_provide_begin_end}/test_vector.cpp (100%) diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/__init__.py b/tests/std/tests/GH_005968_headers_provide_begin_end/__init__.py similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/__init__.py rename to tests/std/tests/GH_005968_headers_provide_begin_end/__init__.py diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/custom_format.py b/tests/std/tests/GH_005968_headers_provide_begin_end/custom_format.py similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/custom_format.py rename to tests/std/tests/GH_005968_headers_provide_begin_end/custom_format.py diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/env.lst b/tests/std/tests/GH_005968_headers_provide_begin_end/env.lst similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/env.lst rename to tests/std/tests/GH_005968_headers_provide_begin_end/env.lst diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/lit.local.cfg b/tests/std/tests/GH_005968_headers_provide_begin_end/lit.local.cfg similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/lit.local.cfg rename to tests/std/tests/GH_005968_headers_provide_begin_end/lit.local.cfg diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/shared_test.hpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_array.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_array.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_array.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_array.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_deque.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_deque.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_deque.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_deque.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_map.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_flat_set.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_forward_list.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_forward_list.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_forward_list.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_forward_list.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_hive.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_inplace_vector.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_list.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_list.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_list.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_list.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_literator.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_literator.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_literator.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_map.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_map.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_map.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_optional.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_regex.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_regex.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_regex.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_regex.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_set.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_set.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_set.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_span.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_stacktrace.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_stacktrace.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_stacktrace.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_stacktrace.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_string.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_string.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string_view.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_string_view.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_map.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_map.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_map.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_set.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_unordered_set.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_set.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_valarray.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_valarray.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_valarray.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_valarray.cpp diff --git a/tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_vector.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_vector.cpp similarity index 100% rename from tests/std/tests/LWG3987_including_flat_foo_doesnt_provide_begin_end/test_vector.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_vector.cpp From 60a2bf82f4f5cd857c2d53d9d9184118a09b264d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Sun, 4 Jan 2026 02:05:28 +0100 Subject: [PATCH 12/31] Also modify list of tests after renaming the directory --- tests/std/test.lst | 2 +- .../tests/GH_005968_headers_provide_begin_end/lit.local.cfg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/std/test.lst b/tests/std/test.lst index e5c34a85fdb..66dddd8b024 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -277,6 +277,7 @@ tests\GH_005546_containers_size_type_cast tests\GH_005553_regex_character_translation tests\GH_005768_pow_accuracy tests\GH_005800_stable_sort_large_alignment +tests\GH_005968_headers_provide_begin_end tests\LWG2381_num_get_floating_point tests\LWG2510_tag_classes tests\LWG2597_complex_branch_cut @@ -290,7 +291,6 @@ tests\LWG3528_make_from_tuple_impl tests\LWG3545_pointer_traits_sfinae tests\LWG3561_discard_block_engine_counter tests\LWG3610_iota_view_size_and_integer_class -tests\LWG3987_including_flat_foo_doesnt_provide_begin_end tests\LWG4084_iostream_uppercase_inf_nan tests\LWG4105_ranges_ends_with_and_integer_class tests\LWG4172_unique_lock_self_move_assignment diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/lit.local.cfg b/tests/std/tests/GH_005968_headers_provide_begin_end/lit.local.cfg index 5c91ec58b81..a2eb46b33dc 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/lit.local.cfg +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/lit.local.cfg @@ -4,6 +4,6 @@ import os import site site.addsitedir(os.path.dirname(os.path.dirname(__file__))) -import LWG3987_including_flat_foo_doesnt_provide_begin_end.custom_format +import GH_005968_headers_provide_begin_end.custom_format -config.test_format = LWG3987_including_flat_foo_doesnt_provide_begin_end.custom_format.CustomTestFormat() +config.test_format = GH_005968_headers_provide_begin_end.custom_format.CustomTestFormat() From 2071173392b39c09c3dbc97fda5b13a10c7dcf56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Thu, 8 Jan 2026 23:48:24 +0100 Subject: [PATCH 13/31] Activate valarray test. --- .../tests/GH_005968_headers_provide_begin_end/test_valarray.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_valarray.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_valarray.cpp index 847fb51ec30..0fef8a143b4 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_valarray.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_valarray.cpp @@ -6,8 +6,6 @@ #include "shared_test.hpp" void test_valarray() { -#if 0 // TRANSITION, fails at the moment, fixed by not-yet accepted GH-5847 std::valarray container{1, 2, 3}; shared_test(container); -#endif } From c7a20c0cbc6022194559224dceb57ab8ad2cc1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Thu, 8 Jan 2026 23:53:19 +0100 Subject: [PATCH 14/31] Wrap construction of individual objects into separate scopes to prevent mistakes. --- .../test_flat_map.cpp | 26 +++++++++++-------- .../test_flat_set.cpp | 16 +++++++----- .../test_map.cpp | 18 ++++++------- .../test_set.cpp | 12 ++++++--- .../test_unordered_map.cpp | 18 ++++++------- .../test_unordered_set.cpp | 14 ++++++---- 6 files changed, 58 insertions(+), 46 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp index 21d2aa820d4..0c9dd304b5a 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp @@ -9,17 +9,21 @@ #include "shared_test.hpp" void test_flat_map() { - std::flat_map container{ - {1, 5}, - {3, 7}, - }; - shared_test(container); - - std::flat_multimap container2{ - {1, 5}, - {3, 7}, - }; - shared_test(container2); + { + std::flat_map container{ + {1, 5}, + {3, 7}, + }; + shared_test(container); + } + + { + std::flat_multimap container2{ + {1, 5}, + {3, 7}, + }; + shared_test(container2); + } } #else // ^^^ defined(__cpp_lib_flat_map) / feature not available vvv diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp index 19e23502704..26dc3b05a01 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp @@ -2,18 +2,22 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#if defined(__cpp_lib_flat_set ) +#if defined(__cpp_lib_flat_set) #include #include "shared_test.hpp" void test_flat_set() { - std::flat_set container{1, 2, 3}; - shared_test(container); - - std::flat_multiset container2{1, 2, 3}; - shared_test(container2); + { + std::flat_set container{1, 2, 3}; + shared_test(container); + } + + { + std::flat_multiset container2{1, 2, 3}; + shared_test(container2); + } } #else // ^^^ defined(__cpp_lib_flat_set) / feature not available vvv diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_map.cpp index 069df2ebbfd..2b3c7ce636c 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_map.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_map.cpp @@ -6,15 +6,13 @@ #include "shared_test.hpp" void test_map() { - std::map container{ - {1, 2}, - {3, 4} - }; - shared_test(container); + { + std::map container{{1, 2}, {3, 4}}; + shared_test(container); + } - std::multimap container2{ - {5, 2}, - {6, 4} - }; - shared_test(container2); + { + std::multimap container2{{5, 2}, {6, 4}}; + shared_test(container2); + } } diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_set.cpp index a48944e789c..7f92da62da0 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_set.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_set.cpp @@ -6,9 +6,13 @@ #include "shared_test.hpp" void test_set() { - std::set container{1,2,3}; - shared_test(container); + { + std::set container{1, 2, 3}; + shared_test(container); + } - std::multiset container2{1,2,3}; - shared_test(container2); + { + std::multiset container2{1, 2, 3}; + shared_test(container2); + } } diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_map.cpp index f4c95af8cce..a800671ae5d 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_map.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_map.cpp @@ -6,15 +6,13 @@ #include "shared_test.hpp" void test_unordered_map() { - std::unordered_map container{ - {1, 2}, - {3, 4} - }; - shared_test(container); + { + std::unordered_map container{{1, 2}, {3, 4}}; + shared_test(container); + } - std::unordered_multimap container2{ - {5, 2}, - {6, 4} - }; - shared_test(container2); + { + std::unordered_multimap container2{{5, 2}, {6, 4}}; + shared_test(container2); + } } diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_set.cpp index ecff1e93622..478c4cf0918 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_set.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_unordered_set.cpp @@ -6,9 +6,13 @@ #include "shared_test.hpp" void test_unordered_set() { - std::unordered_set container{1,2,3}; - shared_test(container); - - std::unordered_multiset container2{4,5,6}; - shared_test(container2); + { + std::unordered_set container{1, 2, 3}; + shared_test(container); + } + + { + std::unordered_multiset container2{4, 5, 6}; + shared_test(container2); + } } From b8abde271afb4adf4e05f792c64e44ed2aee21a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Michal?= Date: Fri, 9 Jan 2026 00:14:17 +0100 Subject: [PATCH 15/31] Fix formatting. --- .../std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp | 2 +- .../GH_005968_headers_provide_begin_end/test_inplace_vector.cpp | 2 +- .../tests/GH_005968_headers_provide_begin_end/test_optional.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp index f8e55358019..4c3ef3beee8 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp @@ -17,4 +17,4 @@ void test_hive() { void test_hive() {} -#endif // feature not available \ No newline at end of file +#endif // feature not available diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp index e46c2c5c450..b773ef3e6dd 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp @@ -17,4 +17,4 @@ void test_inplace_vector() { void test_inplace_vector() {} -#endif // feature not available \ No newline at end of file +#endif // feature not available diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp index 9b19aeb600f..a0541ef9d05 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp @@ -17,4 +17,4 @@ void test_optional() { void test_optional() {} -#endif // feature not available \ No newline at end of file +#endif // feature not available From 2b32511b3e73225a44667e32ef55fd6ad5b0d430 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 08:39:06 -0800 Subject: [PATCH 16/31] Fix typo: test_literator.cpp => test_iterator.cpp --- .../{test_literator.cpp => test_iterator.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/std/tests/GH_005968_headers_provide_begin_end/{test_literator.cpp => test_iterator.cpp} (100%) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_literator.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp similarity index 100% rename from tests/std/tests/GH_005968_headers_provide_begin_end/test_literator.cpp rename to tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp From 6c6999c698d0f76dfdc408754a95e78b7c6fd634 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:05:17 -0800 Subject: [PATCH 17/31] Update Standard citation. --- .../tests/GH_005968_headers_provide_begin_end/shared_test.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index fd6ce8d9353..24dd82ec608 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -2,8 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // Intentionally avoid including anything, relevant headers are included in .cpp files. -// Test requirements of N5014 [iterator.range]/1 -// LWG-3987 added headers +// Test requirements of N5032 [iterator.range]/1. namespace detail { From 77d7de87cd2edc71e1a159e7554a47919f65266b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:06:19 -0800 Subject: [PATCH 18/31] West const. --- .../tests/GH_005968_headers_provide_begin_end/shared_test.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index 24dd82ec608..53ce21adbe8 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -78,7 +78,7 @@ template void shared_test(C& c) { detail::test_free_container_functions(c); // as_const from not required to be available - detail::test_free_container_functions(const_cast(c)); + detail::test_free_container_functions(const_cast(c)); detail::test_free_array_functions(); } From 2a34cbc8f94ea1ff863d08172d79fc917bf265f9 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:08:05 -0800 Subject: [PATCH 19/31] Add `#pragma once`. --- .../tests/GH_005968_headers_provide_begin_end/shared_test.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index 53ce21adbe8..65b5641d24e 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#pragma once + // Intentionally avoid including anything, relevant headers are included in .cpp files. // Test requirements of N5032 [iterator.range]/1. From 9af82e786592e56d2b4aeb67ab186eb0553c7dd1 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:10:08 -0800 Subject: [PATCH 20/31] typename => class --- .../GH_005968_headers_provide_begin_end/shared_test.hpp | 8 ++++---- .../GH_005968_headers_provide_begin_end/test_iterator.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index 65b5641d24e..2a4e489517c 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -14,14 +14,14 @@ namespace detail { // Define minimal metaprogramming tools, avoid including anything #define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ - template \ + template \ struct conditional_caller_of_##member_name { \ constexpr void operator()(T& t) { \ (void) t; \ } \ }; \ \ - template \ + template \ struct conditional_caller_of_##member_name(nullptr)->member_name())> { \ constexpr auto operator()(T& t) { \ return member_name(t); \ @@ -40,7 +40,7 @@ namespace detail { DEFINE_CONDITIONAL_CALLER_OF(data); - template + template void test_free_container_functions(C& c) { (void) begin(c); (void) end(c); @@ -76,7 +76,7 @@ namespace detail { } } // namespace detail -template +template void shared_test(C& c) { detail::test_free_container_functions(c); // as_const from not required to be available diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp index 6a535702bc5..886f92536df 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp @@ -26,7 +26,7 @@ struct minimal_container { // Self-test the template machinery to check it properly detects member functions namespace detail { - template + template constexpr bool minimal_container_test(C& c) { // when the CONDITIONALLY_CALL expression fails to detect the member, it has type voi, i.e. clearly // incompatible with operator==. If the detection mechanism did not work properly, this would fail to compile. From af14ffad99a77ec70e111b2c104f3e207ab9d341 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:18:15 -0800 Subject: [PATCH 21/31] Fix typo: voi => void --- .../tests/GH_005968_headers_provide_begin_end/test_iterator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp index 886f92536df..a78d34ae180 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp @@ -28,7 +28,7 @@ struct minimal_container { namespace detail { template constexpr bool minimal_container_test(C& c) { - // when the CONDITIONALLY_CALL expression fails to detect the member, it has type voi, i.e. clearly + // when the CONDITIONALLY_CALL expression fails to detect the member, it has type void, i.e. clearly // incompatible with operator==. If the detection mechanism did not work properly, this would fail to compile. return CONDITIONALLY_CALL(c, size) == minimal_container::magic_value; } From 75c7dea9766a72a857165fc47a09cd0626700780 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:36:19 -0800 Subject: [PATCH 22/31] Improve consistency of arrow comments. --- .../GH_005968_headers_provide_begin_end/test_flat_map.cpp | 4 ++-- .../GH_005968_headers_provide_begin_end/test_flat_set.cpp | 4 ++-- .../tests/GH_005968_headers_provide_begin_end/test_hive.cpp | 4 ++-- .../test_inplace_vector.cpp | 4 ++-- .../GH_005968_headers_provide_begin_end/test_optional.cpp | 4 ++-- .../tests/GH_005968_headers_provide_begin_end/test_span.cpp | 2 +- .../GH_005968_headers_provide_begin_end/test_stacktrace.cpp | 2 +- .../GH_005968_headers_provide_begin_end/test_string_view.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp index 0c9dd304b5a..ae01d92c2d5 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp @@ -26,8 +26,8 @@ void test_flat_map() { } } -#else // ^^^ defined(__cpp_lib_flat_map) / feature not available vvv +#else // ^^^ defined(__cpp_lib_flat_map) / !defined(__cpp_lib_flat_map) vvv void test_flat_map() {} -#endif // feature not available +#endif // ^^^ !defined(__cpp_lib_flat_map) ^^^ diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp index 26dc3b05a01..39f12b433de 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp @@ -20,8 +20,8 @@ void test_flat_set() { } } -#else // ^^^ defined(__cpp_lib_flat_set) / feature not available vvv +#else // ^^^ defined(__cpp_lib_flat_set) / !defined(__cpp_lib_flat_set) vvv void test_flat_set() {} -#endif // feature not available +#endif // ^^^ !defined(__cpp_lib_flat_set) ^^^ diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp index 4c3ef3beee8..dc41da28df0 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp @@ -13,8 +13,8 @@ void test_hive() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_hive) / feature not available vvv +#else // ^^^ defined(__cpp_lib_hive) / !defined(__cpp_lib_hive) vvv void test_hive() {} -#endif // feature not available +#endif // ^^^ !defined(__cpp_lib_hive) ^^^ diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp index b773ef3e6dd..70a6961c392 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp @@ -13,8 +13,8 @@ void test_inplace_vector() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_inplace_vector) / feature not available vvv +#else // ^^^ defined(__cpp_lib_inplace_vector) / !defined(__cpp_lib_inplace_vector) vvv void test_inplace_vector() {} -#endif // feature not available +#endif // ^^^ !defined(__cpp_lib_inplace_vector) ^^^ diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp index a0541ef9d05..2186e48cdaf 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp @@ -13,8 +13,8 @@ void test_optional() { shared_test(container); } -#else // ^^^ defined(__cpp_lib_optional_range_support) / feature not available vvv +#else // ^^^ defined(__cpp_lib_optional_range_support) / !defined(__cpp_lib_optional_range_support) vvv void test_optional() {} -#endif // feature not available +#endif // ^^^ !defined(__cpp_lib_optional_range_support) ^^^ diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp index 4cb1fc26b2d..15618086de6 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp @@ -18,4 +18,4 @@ void test_span() { void test_span() {} -#endif // !_HAS_CXX20 +#endif // ^^^ !_HAS_CXX20 ^^^ diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_stacktrace.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_stacktrace.cpp index 0b9bfdcde64..dab992410ba 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_stacktrace.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_stacktrace.cpp @@ -17,4 +17,4 @@ void test_stacktrace() { void test_stacktrace() {} -#endif // !_HAS_CXX23 +#endif // ^^^ !_HAS_CXX23 ^^^ diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp index df5866b094c..5191c0576c1 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp @@ -17,4 +17,4 @@ void test_string_view() { void test_string_view() {} -#endif // !_HAS_CXX17 +#endif // ^^^ !_HAS_CXX17 ^^^ From 2a4faadae9b2cf659dc1edb5bf999950b47523ca Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:41:15 -0800 Subject: [PATCH 23/31] Add reminders when implementing features. --- .../tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp | 1 + .../tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp | 1 + .../std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp | 1 + .../GH_005968_headers_provide_begin_end/test_inplace_vector.cpp | 1 + .../tests/GH_005968_headers_provide_begin_end/test_optional.cpp | 1 + 5 files changed, 5 insertions(+) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp index ae01d92c2d5..76a545f65c4 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_map.cpp @@ -3,6 +3,7 @@ #include #if defined(__cpp_lib_flat_map) +static_assert(false, "When this feature is implemented, update this to a Standard mode check."); #include diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp index 39f12b433de..415f2b61dec 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp @@ -3,6 +3,7 @@ #include #if defined(__cpp_lib_flat_set) +static_assert(false, "When this feature is implemented, update this to a Standard mode check."); #include diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp index dc41da28df0..3ef1701b4ef 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_hive.cpp @@ -3,6 +3,7 @@ #include #if defined(__cpp_lib_hive) +static_assert(false, "When this feature is implemented, update this to a Standard mode check."); #include diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp index 70a6961c392..990486a72ac 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_inplace_vector.cpp @@ -3,6 +3,7 @@ #include #if defined(__cpp_lib_inplace_vector) +static_assert(false, "When this feature is implemented, update this to a Standard mode check."); #include diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp index 2186e48cdaf..afcaeac5cd9 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_optional.cpp @@ -3,6 +3,7 @@ #include #if defined(__cpp_lib_optional_range_support) +static_assert(false, "When this feature is implemented, update this to a Standard mode check."); #include From 77dbd50f236979f92a0222cacc2ce8c8d762bd6e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:42:32 -0800 Subject: [PATCH 24/31] Avoid quasi-shadowing: array => arr --- .../tests/GH_005968_headers_provide_begin_end/test_span.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp index 15618086de6..6487b673a63 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_span.cpp @@ -9,8 +9,8 @@ #include "shared_test.hpp" void test_span() { - int array[]{1, 2, 3}; - std::span container(array); + int arr[]{1, 2, 3}; + std::span container(arr); shared_test(container); } From 76ced3275a91f1a85c26f96338272299352bb419 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:44:13 -0800 Subject: [PATCH 25/31] string_view can directly view "hello". --- .../GH_005968_headers_provide_begin_end/test_string_view.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp index 5191c0576c1..5f16e21f046 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_string_view.cpp @@ -9,8 +9,7 @@ #include "shared_test.hpp" void test_string_view() { - char text[] = "hello"; - std::string_view container = text; + std::string_view container = "hello"; shared_test(container); } #else // ^^^ _HAS_CXX17 / !_HAS_CXX17 vvv From 4dd01ca2c53f04206fdcc9a427d4a5d0c56f4bfe Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:46:41 -0800 Subject: [PATCH 26/31] Avoid inconsistent use of CTAD for flat_set. --- .../GH_005968_headers_provide_begin_end/test_flat_set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp index 415f2b61dec..811f96eeea9 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_flat_set.cpp @@ -11,12 +11,12 @@ static_assert(false, "When this feature is implemented, update this to a Standar void test_flat_set() { { - std::flat_set container{1, 2, 3}; + std::flat_set container{1, 2, 3}; shared_test(container); } { - std::flat_multiset container2{1, 2, 3}; + std::flat_multiset container2{1, 2, 3}; shared_test(container2); } } From 5c3fde2fd6c694c533b62689f6c53e500afdd07e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 09:58:49 -0800 Subject: [PATCH 27/31] Don't bother naming unused `t`. --- .../tests/GH_005968_headers_provide_begin_end/shared_test.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index 2a4e489517c..e7417e4cd60 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -16,9 +16,7 @@ namespace detail { #define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ template \ struct conditional_caller_of_##member_name { \ - constexpr void operator()(T& t) { \ - (void) t; \ - } \ + constexpr void operator()(T&) {} \ }; \ \ template \ From c45cc985d58cc4679340cb9ab43b574a2ab1432b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 10:08:59 -0800 Subject: [PATCH 28/31] Order rbegin/rend before crbegin/crend. --- .../GH_005968_headers_provide_begin_end/test_iterator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp b/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp index a78d34ae180..eaa4910839c 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/test_iterator.cpp @@ -12,10 +12,10 @@ struct minimal_container { constexpr void end() const {} constexpr void cbegin() const {} constexpr void cend() const {} - constexpr void crbegin() const {} - constexpr void crend() const {} constexpr void rbegin() const {} constexpr void rend() const {} + constexpr void crbegin() const {} + constexpr void crend() const {} constexpr size_t size() const { return magic_value; } From 9702094e51cefbd83a536f8eec92a009ef59db9f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 10:18:50 -0800 Subject: [PATCH 29/31] Explicitly call out the order assumption. --- .../tests/GH_005968_headers_provide_begin_end/shared_test.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index e7417e4cd60..353d0195d2c 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -3,7 +3,9 @@ #pragma once -// Intentionally avoid including anything, relevant headers are included in .cpp files. +// Intentionally avoid including anything. Order assumption: shared_test.hpp assumes +// that the relevant Standard headers have already been included by the .cpp files. + // Test requirements of N5032 [iterator.range]/1. namespace detail { From 36aba7562026006469efbb3c9137d0b2ebf6a446 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 10:28:32 -0800 Subject: [PATCH 30/31] ssize is special. --- .../shared_test.hpp | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index 353d0195d2c..f8a9f70f61d 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -15,31 +15,32 @@ namespace detail { // Define minimal metaprogramming tools, avoid including anything -#define DEFINE_CONDITIONAL_CALLER_OF(member_name) \ - template \ - struct conditional_caller_of_##member_name { \ - constexpr void operator()(T&) {} \ - }; \ - \ - template \ - struct conditional_caller_of_##member_name(nullptr)->member_name())> { \ - constexpr auto operator()(T& t) { \ - return member_name(t); \ - } \ +#define DEFINE_CONDITIONAL_CALLER_OF_FREE_MEMBER(free_name, member_name) \ + template \ + struct conditional_caller_of_##free_name { \ + constexpr void operator()(T&) {} \ + }; \ + \ + template \ + struct conditional_caller_of_##free_name(nullptr)->member_name())> { \ + constexpr auto operator()(T& t) { \ + return free_name(t); \ + } \ }; -#define CONDITIONALLY_CALL(c, member_name) conditional_caller_of_##member_name{}(c) +#define DEFINE_CONDITIONAL_CALLER_OF(name) DEFINE_CONDITIONAL_CALLER_OF_FREE_MEMBER(name, name) + +#define CONDITIONALLY_CALL(c, name) conditional_caller_of_##name{}(c) DEFINE_CONDITIONAL_CALLER_OF(rbegin); DEFINE_CONDITIONAL_CALLER_OF(rend); DEFINE_CONDITIONAL_CALLER_OF(crbegin); DEFINE_CONDITIONAL_CALLER_OF(crend); DEFINE_CONDITIONAL_CALLER_OF(size); - DEFINE_CONDITIONAL_CALLER_OF(ssize); + DEFINE_CONDITIONAL_CALLER_OF_FREE_MEMBER(ssize, size); // N5032 [iterator.range]/18 DEFINE_CONDITIONAL_CALLER_OF(empty); DEFINE_CONDITIONAL_CALLER_OF(data); - template void test_free_container_functions(C& c) { (void) begin(c); From bf6e064991887deb46781f7dca02149dea99f650 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 20 Jan 2026 10:36:24 -0800 Subject: [PATCH 31/31] Always guard ssize for C++20. --- .../tests/GH_005968_headers_provide_begin_end/shared_test.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp index f8a9f70f61d..0937ddb1d26 100644 --- a/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp +++ b/tests/std/tests/GH_005968_headers_provide_begin_end/shared_test.hpp @@ -37,7 +37,9 @@ namespace detail { DEFINE_CONDITIONAL_CALLER_OF(crbegin); DEFINE_CONDITIONAL_CALLER_OF(crend); DEFINE_CONDITIONAL_CALLER_OF(size); +#if _HAS_CXX20 DEFINE_CONDITIONAL_CALLER_OF_FREE_MEMBER(ssize, size); // N5032 [iterator.range]/18 +#endif DEFINE_CONDITIONAL_CALLER_OF(empty); DEFINE_CONDITIONAL_CALLER_OF(data); @@ -52,7 +54,9 @@ namespace detail { CONDITIONALLY_CALL(c, crbegin); // missing e.g. for forward_list CONDITIONALLY_CALL(c, crend); // missing e.g. for forward_list CONDITIONALLY_CALL(c, size); // missing e.g. for optional +#if _HAS_CXX20 CONDITIONALLY_CALL(c, ssize); // missing e.g. for optional +#endif CONDITIONALLY_CALL(c, empty); // missing e.g. for valarray CONDITIONALLY_CALL(c, data); // missing e.g. for valarray }