[X86] combinePTESTCC - fold PTESTC(PCMPEQ(X,0),-1) == PTESTZ(X,X) (#123466)
[llvm-project.git] / libcxx / test / std / iterators / iterator.primitives / range.iter.ops / range.iter.ops.next / constraints.compile.pass.cpp
blobb3f7c75e7636c6ee018e9cc028dc34fd3b6fe885
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // ranges::next
12 // Make sure we're SFINAE-friendly when the template argument constraints are not met.
14 #include <iterator>
16 #include <cstddef>
17 #include <memory>
18 #include <utility>
19 #include "test_iterators.h"
21 template <class ...Args>
22 concept has_ranges_next = requires (Args&& ...args) {
23 { std::ranges::next(std::forward<Args>(args)...) };
26 using It = std::unique_ptr<int>;
27 static_assert(!has_ranges_next<It>);
28 static_assert(!has_ranges_next<It, std::ptrdiff_t>);
29 static_assert(!has_ranges_next<It, It>);
30 static_assert(!has_ranges_next<It, std::ptrdiff_t, It>);
32 // Test the test
33 using It2 = forward_iterator<int*>;
34 static_assert(has_ranges_next<It2>);
35 static_assert(has_ranges_next<It2, std::ptrdiff_t>);
36 static_assert(has_ranges_next<It2, std::ptrdiff_t, It2>);