llvm-project/libcxx/test/std
Aaron Jacobs a0549ee2a3 [libc++] type_traits: fix short-circuiting in std::conjunction.
Replace the two-level implementation with a simpler one that directly subclasses
the predicates, avoiding the instantiation of the template to get the `type`
member in a situation where we should short-circuit. This prevents incorrect
diagnostics when the instantiated predicate contains a static assertion.

Add a test case that reproduced the previous problem. The existing test case
involving `HasNoValue` didn't catch the problem because `HasNoValue` was in the
final position. The bug comes up when the predicate that shouldn't be
instantiated is after the short-circuit position but there is more to follow,
because then `__conjunction_impl<False, BadPredicate, ...>` instantiates
`__conjunction_impl<BadPredicate, ...>` (in order to obtain its `type` member),
which in turn instantiates `BadPredicate` in order to obtain its `value` member.

In contrast the new implementation doesn't recurse in instantiation any further
than it needs to, because it doesn't require particular members of the recursive
case.

I've also updated the test cases for `std::disjunction` to match,
although it doesn't have the same particular bug (its implementation is
quite different).

Fixes #58490.

Reviewed By: #libc, ldionne, philnik

Spies: philnik, ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D136318
2022-10-21 13:09:16 +02:00
..
algorithms Revert "[libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`" 2022-10-02 16:23:35 -07:00
atomics [libc++] Always query the compiler to find whether a type is always lockfree 2022-09-19 11:10:02 -04:00
concepts [libc++] Remove unused __functional includes 2022-05-28 10:12:39 +02:00
containers [libc++] Granularize the rest of memory 2022-09-05 12:36:41 +02:00
depr [libc++][cuchar] Declare std::c8rtomb and std::mbrtoc8 in <cuchar> if available. 2022-09-10 21:10:33 -04:00
diagnostics [libc++] Fix ADL for `make_error_{code,condition}` 2022-09-30 17:23:45 -04:00
experimental [libc++] Granularize the rest of memory 2022-09-05 12:36:41 +02:00
input.output [libc++] Remove std::function in C++03 2022-10-19 11:08:35 +02:00
iterators [libc++] Suppress -Wctad-maybe-unsupported on types w/o deduction guides 2022-10-03 14:05:08 -04:00
language.support [libc++] Implements constexpr <charconv>. 2022-10-12 17:43:23 +02:00
library/description/conventions [libc++] Make <ranges> non-experimental 2022-08-18 16:59:58 -04:00
localization [libc++] Remove unique usage of the en_US locale in a test 2022-09-30 14:59:55 -04:00
namespace [runtimes] Rename various libcpp-has-no-XYZ Lit features to just no-XYZ 2022-05-27 15:24:45 -04:00
numerics [libc++][random] Removes transitive includes. 2022-09-11 17:39:27 +02:00
ranges [libc++][ranges] implement `std::ranges::drop_while_view` 2022-10-18 19:34:47 +01:00
re [libc++] Extend check for non-ASCII characters to src/, test/ and benchmarks/ 2022-08-23 18:36:38 -04:00
strings [libc++][NFC] Fix incorrect main signatures in tests 2022-10-12 16:47:32 -04:00
thread [libc++] Suppress -Wctad-maybe-unsupported on types w/o deduction guides 2022-10-03 14:05:08 -04:00
time [libc++][chrono] Implements formatter weekday. 2022-10-18 20:40:06 +02:00
utilities [libc++] type_traits: fix short-circuiting in std::conjunction. 2022-10-21 13:09:16 +02:00
pstl