* Now that the test uses `_HAS_CXX17` and `_HAS_CXX20`,
we need to include `<version>` at the very top.
* Fix damage to the `__cpp_rtti` test.
Additional cleanups:
* Capitalize "Clang" consistently.
* Sort prefixes like `__cpp_init_captures` before
`__cpp_initializer_lists`. This is lexicographic
('_' is less than '[a-z]') and matches the Standard's ordering.
* Remove `_M_CEE` comments for preprocessor directives. Earlier, we
decided that such systematic comments are unnecessarily noisy in this
test specifically, but these comments were simply missed.
* Remove inconsistent empty line.
Rename the variable template `disable_sized_sentinel` to `disable_sized_sentinel_for` for consistency with the name of the associated concept `sized_sentinel_for`.
Addresses #39.
When `defined(__cpp_lib_concepts)`, `(back_|front_|)insert_iterator` are default constructible, and have `ptrdiff_t` as difference type.
Skip libc++ tests broken by this change.
This change removes the last "nonessential" stack frame that would be encountered for threads, and makes the debugging experience for several standard components, like `std::function`, nicer by not needing so many step into / step out of sequences.
![image](https://user-images.githubusercontent.com/1544943/75860992-92b2b000-5db1-11ea-90f1-d7ec3adde21b.png)
1. CRT's thread entry point
2. std::thread's entry point that staples the parameters on
3. invoke
4. already user code yay!
Hopefully this makes debug codegen better too, particularly now that ranges hammers invoke even harder than we used to.
I didn't change any of the metaprogramming for deciding which strategy to use -- I like that we don't use SFINAE to make that decision, and don't really consider myself competent enough a metaprogrammer to confidently make changes there. I just make `_Invoker_xyz` also supply a strategy value that is fed into `if constexpr`. @CaseyCarter suggested some larger changes which might have sped up metaprogramming I tried, but ran into issues because one can't deduce the calling convention of pointers-to-member-function.
I've also made a one time exception to our usual policy of using `std::forward` rather than `static_cast`, with the rationale that `invoke` is hammered *everywhere*, and also by traits, and we want the debugging experience of that to be as nice as possible.
(Also drive-by removed unnecessary compilation of iostreams from the `Dev10_729003_bind_reference_wrapper` I noticed debugging a test case failure)
Co-authored-by: Casey Carter <cartec69@gmail.com>
* Several range algorithms
In `<algorithm>`, implement:
* the generic algorithm result types from P2106R0 (lines 75-227)
* `ranges::for_each` and its result alias `for_each_result` (lines 289-322)
* `ranges::for_each_n` and its result alias `for_each_result_n` (lines 324-351) from P1243R4
* `ranges::find` (lines 353-384)
* `ranges::find_if` (lines 396-426)
* `ranges::find_if_not` (lines 454-484)
* `ranges::count` (lines 526-568)
* `ranges::count_if` (lines 587-617)
* `ranges::mismatch` and its result alias `mismatch_result` (lines 798-891)
* `ranges::equal` (lines 893-980)
* `ranges::all_of` (lines 1006-1033)
* `ranges::any_of` (lines 1060-1087)
* `ranges::none_of` (lines 1114-1141)
* `ranges::copy` and its result alias `copy_result` (lines 1143-1175)
* `ranges::copy_n` and its result alias `copy_n_result` (lines 1177-1207)
* `ranges::copy_if` and its result alias `copy_if_result` (lines 1262-1302)
In `<concepts>`:
* implement LWG-3194 which includes the resolution of LWG-3151 (lines 51-53)
* LWG-3175 has been merged, remove conditional implementation (line 183)
* replace `boolean` concept with _`boolean-testable`_ concept from P1964R2 (lines 198-237, 283)
* move `movable` (pun intended) into synopsis order (lines 254-256)
* Modify concept `copyable` per P2102R0 (lines 260-261)
* Implement concept `equivalence_relation` from P1716R3 (lines 290-293)
In `<xutility>`:
* promote `identity` from `<functional>` for visibility in `<algorithm>` (lines 160-168)
* promote `common_range` from `<ranges>` for visibility in `<algorithm>` (lines 3091-3095)
* remove LWG-3247 and LWG-3299 annotations (lines 622, 626, and 963)
* prefix `indirectly_` to the names of `readable_traits`, `readable`, and `writable` (a great many lines); and modify `iter_value_t` (lines 366-367), `iter_reference_t` (lines ), `iter_difference_t`, `iter_rvalue_reference_t`, `indirectly_readable` (lines 688-701) and `indirectly_swappable` per P1878R1
* define alias template `_Make_unsigned_like_t` to implement P1522R1's _`make-unsigned-like-t`_ (it does nothing interesting yet, since we provide no integer-class types) (lines 727-729)
* implement the "Indirect callable" concepts `indirectly_unary_invocable`, `indirectly_regular_unary_invocable`, `indirect_unary_predicate`, `indirect_binary_predicate`, `indirect_equivalence_relation`, `indirect_strict_weak_order`, and helpers `indirect_result_t` and `projected` (lines 852-926)
* implement `indirectly_copyable` and `indirectly_copyable_storable` concepts (lines 939-952)
* implement `indirectly_swappable`, `indirectly_comparable`, `permutable`, `mergeable`, and `sortable` concepts (lines 1032-1061)
* rename `safe_range` and `enable_safe_range` to `borrowed_range` and `enable_borrowed_range` per LWG-3379 (lines 2168-2173 and 2327-2330)
* remove "Implements D2091R0" comments (various lines in 2175-2710)
* add `ranges::data` to the list of access CPOs that hard error for arrays of incomplete element types (lines 2204-2205 and 2277-2278)
* `ranges::empty` rejects arrays of unbound bound per P2091R0 (lines 2664-2692)
* implement concept `_Not_same_as` (the exposition-only _`not-same-as`_ from the working draft) (lines 3087-3089)
* implement `ranges::dangling` (lines 3097-3102)
* implement `ranges::borrowed_iterator_t` (lines 3104-3106)
In `<yvals_core.h>`:
* Indicate implementation of:
* P1207R4 Movability of Single-Pass Iterators
* P1248R1 Fixing Relations
* P1474R1 Helpful Pointers For contiguous_iterator
* P1716R3 Range Comparison Algorithms Are Over-Constrained
* P1878R1 Constraining Readable Types
* P1964R2 Replacing `boolean` with _`boolean-testable`_
* P2091R0 Fixing Issues With Range Access CPOs
* P2102R0 Make "implicit expression variations" More Explicit
* and partial implementation of:
* P1243R4 Rangify New Algorithms
* remove conditional definition of `_HAS_STD_BOOLEAN` (we never has `std::boolean` now)
`tests/std/include/instantiate_algorithms.hpp`:
* define non-movable type `Immobile`, and use it to ensure that standard algorithms neither copy nor move random number generators nor uniform random bit generators
Add header `tests/std/include/range_algorithm_support.hpp` with support machinery for the ranges algorithm tests. It notably defines:
* `is_permissive` for determining whether we are compiling in MSVC's permissive mode (lines 18-37)
* A class template `borrowed<bool>` whose specializations always model `range` and model `borrowed_range` iff the template parameter is `true` (lines 39-46)
* Function objects `get_first` and `get_second` which project the pertinent member from `pair` arguments (lines 48-54)
* A class template `move_only_range<T>` which adapts a `contiguous_range` of `T` into a move-only `view` with move-only `input_iterator`s (lines 56-150)
* A "phony" iterator class template `test_iterator` with tunable category, value type, and difference capability for instantiation tests (lines 152-363)
* A similar "phony" class template `test_range` with tunable category, size, and commonality (i.e., is the sentinel type the same as the iterator type) (lines 365-423)
* "phony" predicate and projection types for instantiation tests (lines 425-442)
* combinatoric instantiation machinery for instantiation tests that instantiate with all interesting kinds of output iterators or input ranges (lines 444-529)
A new compile-only test `tests/std/tests/P0896R4_ranges_algorithm_machinery` which covers:
* `indirectly_unary_invocable`/`indirectly_regular_unary_invocable`
* `indirect_unary_predicate`/`indirect_binary_predicate`/`indirect_result_t`
* `projected`
* `indirectly_copyable`/`indirectly_swappable`/`indirectly_comparable`
* `dangling`/`borrowed_iterator_t`
* the result types `in_found_result`/`in_fun_result`/`in_in_result`/`in_out_result`/`in_in_out_result`/`in_out_out_result`/`min_max_result`
Very simple smoke and instantiation tests for the 15 new algorithms in:
* `tests/std/tests/P0896R4_ranges_alg_all_of`
* `tests/std/tests/P0896R4_ranges_alg_any_of`
* `tests/std/tests/P0896R4_ranges_alg_copy`
* `tests/std/tests/P0896R4_ranges_alg_copy_if`
* `tests/std/tests/P0896R4_ranges_alg_copy_n`
* `tests/std/tests/P0896R4_ranges_alg_count`
* `tests/std/tests/P0896R4_ranges_alg_count_if`
* `tests/std/tests/P0896R4_ranges_alg_equal`
* `tests/std/tests/P0896R4_ranges_alg_find`
* `tests/std/tests/P0896R4_ranges_alg_find_if`
* `tests/std/tests/P0896R4_ranges_alg_find_if_not`
* `tests/std/tests/P0896R4_ranges_alg_for_each`
* `tests/std/tests/P0896R4_ranges_alg_for_each_n`
* `tests/std/tests/P0896R4_ranges_alg_mismatch`
* `tests/std/tests/P0896R4_ranges_alg_none_of`
Resolves:
* #537 `<concepts>`: LWG-3175 has been accepted, so we should remove commented-out code
* #540 LWG-3194 `ConvertibleTo` prose does not match code
* #546 LWG-3379 `safe` in several library names is misleading
* #559 P1964R2 "Replacing `boolean` with _`boolean-testable`_"
* #561 P2102R0 "Making 'Implicit Expression Variations' More Explicit"
* #563 P2091R0 "Fixing Issues With Range Access CPOs"
* <filesystem>::space fails with no read access to root
Avoid the unnecessary call to GetVolumePathNameW because read access for this call is required on the root of the mounted volume. This call used to be required for GetDiskFreeSpace, but should not be used for GetDiskFreeSpaceExW, where the full path should be used. The appropriate read permissions on the given path will be taken into consideration.
Co-authored-by: Billy O'Neal <billy.oneal@gmail.com>
* Removes VSO-406237 "C1XX does not do constant initialization where the standard requires" workarounds.
* Introduce `_Immortalize_memcpy_image` which avoids the need for synchronization when constructing the error categories. See the big comment block for explanation of how we got here. For compilers which let us declare instances with the empty virtual destructor as constexpr variables (currently only clang in C++20 mode), we can avoid the workaround.
* Turn on `/Zc:threadSafeInit-` and warning 4640 in most tests to ensure we aren't emitting thread-local initializers in `<system_error>`.
* Move `_Immortalizer` and friends to the one remaining caller in the `exception_ptr` implementation.
* Remove `_Generic_error_category` from the base class hierarchies of error categories to workaround DevCom-928781.
Includes:
* concepts `three_way_comparable` and `three_way_comparable_with`,
* type trait `std::compare_three_way_result` (with `_t` alias), and
* function object `compare_three_way`.
in `<compare>`, and:
* function objects `ranges::equal_to` and `ranges::less` (in `<xutility>` for
easy algorithm access), `ranges::not_equal_to`, `ranges::less_equal`,
`ranges::greater`, and `ranges::greater_equal` (in `<functional>`),
* slight refactoring of concept definitions in `<concepts>` to avoid redundant
requirements for the single-type comparison concepts `equality_comparable`,
`totally_ordered`, and `three_way_comparable`,
* heavy refactoring of the trait `common_comparison_category` (and `_t` alias)
in `<compare>` to requires only `n + c` template instantiations instead of `cn`
template instantiations,
* ======== ABI BREAK =========== remove the `_Is_unordered` member from
`std::partial_ordering` in `<compare>` since (a) it's true if and only if the
stored value has a particular value, and (b) Clang expects all of the
comparison category types to have size 1,
* reorder all `is_transparent` alias declarations in the STL to be after the
corresponding `operator()` to agree with synopsis order.
Also adds a new test `P0896R4_P1614R2_comparisons` that exercises the above.
The ABI BREAK sounds scary - as it should - but note that:
* this is a `/std:c++latest` feature, which is subject to change,
* objects of comparison category type aren't typically stored,
* only MSVC has released `<compare>` so far, so it's not widely used.
Altogether, it's extremely unlikely that anyone has encoded this in ABI.
* Add tests/std.
* Update other files.
NOTICE.txt
Mention the LLVM Project, as its code appears
in tests/std/tests/P0220R1_optional/test.cpp and elsewhere.
azure-devops/enforce-clang-format.cmd
Process everything within tests. This includes libcxx, std, and tr1.
docs/cgmanifest.json
Update this file for Microsoft-internal purposes. (It records the commit
hashes of repos whose source code we've incorporated into our own repo.
For llvm-project, this is distinct from the submodule's current commit.)
tests/tr1/run.pl
Mention runbe.pl in lowercase, to match the file itself.
* Improve run.pl and runbe.pl comments.
* Add the tr1 test suite.
Works towards #144. Note that this is just the source code; the
infrastructure to automatically build and run the tests is coming soon.
Update enforce-clang-format.cmd as parallelize is recursive. (I verified
that behavior by running parallelize directly.) We don't need to mention
stl/inc's subdirectories. We can mention all of tools because
clang-format detects file extensions and the other files in tools are
fine. (In contrast, excluding stl/msbuild saves time.) Finally, add
tests/tr1 (which is why we depend on recursive behavior, due to its many
subdirectories). Also, update the git status and git diff commands to
print differences in the tests directory too.
* Add "accepted extensions" to parallelize.
Deletes stream insertion operators for `ostream` with non-`char` character types, and for `wostream` with `charX_t` character types. The `char8_t` operators are deleted in all language modes, but the others are C++20-only to avoid gratuitous breakage (with escape hatch `_HAS_STREAM_INSERTIONS_REMOVED_IN_CXX20`).
Skips libc++ tests that expect the pre-P1423R3 value of `__cpp_lib_char8_t`.
Resolves#59.
* Implement constexpr algorithms.
Resolves GH-6 ( P0202R3 ), resolves GH-38 ( P0879R0 ), and drive-by fixes GH-414.
Everywhere: Add constexpr, _CONSTEXPR20, and _CONSTEXPR20_ICE to things.
skipped_tests.txt: Turn on all tests previously blocked by missing constexpr algorithms (and exchange and swap). Mark those algorithms that cannot be turned on that we have outstanding PRs for with their associated PRs.
yvals_core.h: Turn on feature test macros.
xutility:
* Move the _Ptr_cat family down to copy, and fix associated SHOUTY comments to indicate that this is really an implementation detail of copy, not something the rest of the standard library intends to use directly. Removed and clarified some of the comments as requested by Casey Carter.
* Extract _Copy_n_core which implements copy_n using only the core language (rather than memcpy-as-an-intrinsic). Note that we cannot use __builtin_memcpy or similar to avoid the is_constant_evaluated check here; builtin_memcpy only works in constexpr contexts when the inputs are of type char.
numeric: Refactor as suggested by GH-414.
* Attempt alternate fix of GH-414 suggested by Stephan.
* Stephan product code PR comments:
* _Swap_ranges_unchecked => _CONSTEXPR20
* _Idl_dist_add => _NODISCARD (and remove comments)
* is_permutation => _NODISCARD
* Add yvals_core.h comments.
* Delete unused _Copy_n_core and TRANSITION, DevCom-889321 comment.
* Put the comments in the right place and remove phantom braces.
* Implement P0357R3
* Update LLVM to get skip of libcxx\test\std\utilities\function.objects\refwrap\weak_result.pass.cpp, and exclude "// REQUIRES: c++98 || c++03 || c++11 || c++14 || c++17" as a 'magic comment'.
Co-authored-by: Billy O'Neal <billy.oneal@gmail.com>
Co-authored-by: Casey Carter <cartec69@gmail.com>
In the test runer. `pstl` is a symlink to `../../../pstl/test/std` (when it exists - which only happens when git is honoring symlinks). The test runner is not prepared for this.
* Port Microsoft-internal MSVC-PR-218746 and MSVC-PR-219383.
* And MSVC-PR-219451:
* Skip llvm-project in validate.cpp.
* Change .vscode/settings.json to CRLF.