forked from NVIDIA/cccl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathless_equal.pass.cpp
56 lines (43 loc) · 1.49 KB
/
less_equal.pass.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11
// <cuda/std/optional>
// template <class T> constexpr bool operator<=(const optional<T>& x, nullopt_t) noexcept;
// template <class T> constexpr bool operator<=(nullopt_t, const optional<T>& x) noexcept;
#include <cuda/std/optional>
#include <cuda/std/cassert>
#include "test_macros.h"
__host__ __device__
constexpr bool test() {
using cuda::std::optional;
using cuda::std::nullopt_t;
using cuda::std::nullopt;
{
typedef int T;
typedef optional<T> O;
O o1; // disengaged
O o2{1}; // engaged
assert( (nullopt <= o1));
assert( (nullopt <= o2));
assert( (o1 <= nullopt));
assert(!(o2 <= nullopt));
static_assert(noexcept(nullopt <= o1), "");
static_assert(noexcept(o1 <= nullopt), "");
}
return true;
}
int main(int, char**) {
test();
#if TEST_STD_VER >= 17
#if !(defined(TEST_COMPILER_CUDACC_BELOW_11_3) && defined(TEST_COMPILER_CLANG))
static_assert(test());
#endif // !(defined(TEST_COMPILER_CUDACC_BELOW_11_3) && defined(TEST_COMPILER_CLANG))
#endif
return 0;
}