1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // UNSUPPORTED: c++03, c++11, c++14, c++17
13 #include <type_traits>
15 #include "test_macros.h"
20 operator A() { return a
; } A a
;
26 operator C() noexcept
{ return c
; } C c
;
29 int main(int, char**) {
30 static_assert((std::is_nothrow_convertible
<int, double>::value
), "");
31 static_assert(!(std::is_nothrow_convertible
<int, char*>::value
), "");
33 static_assert(!(std::is_nothrow_convertible
<A
, B
>::value
), "");
34 static_assert((std::is_nothrow_convertible
<D
, C
>::value
), "");
36 static_assert((std::is_nothrow_convertible_v
<int, double>), "");
37 static_assert(!(std::is_nothrow_convertible_v
<int, char*>), "");
39 static_assert(!(std::is_nothrow_convertible_v
<A
, B
>), "");
40 static_assert((std::is_nothrow_convertible_v
<D
, C
>), "");
42 static_assert((std::is_nothrow_convertible_v
<const void, void>), "");
43 static_assert((std::is_nothrow_convertible_v
<volatile void, void>), "");
44 static_assert((std::is_nothrow_convertible_v
<void, const void>), "");
45 static_assert((std::is_nothrow_convertible_v
<void, volatile void>), "");
47 static_assert(!(std::is_nothrow_convertible_v
<int[], double[]>), "");
48 static_assert(!(std::is_nothrow_convertible_v
<int[], int[]>), "");
49 static_assert(!(std::is_nothrow_convertible_v
<int[10], int[10]>), "");
50 static_assert(!(std::is_nothrow_convertible_v
<int[10], double[10]>), "");
51 static_assert(!(std::is_nothrow_convertible_v
<int[5], double[10]>), "");
52 static_assert(!(std::is_nothrow_convertible_v
<int[10], A
[10]>), "");
56 static_assert(!(std::is_nothrow_convertible_v
<V
, V
>), "");
57 static_assert(!(std::is_nothrow_convertible_v
<V
, I
>), "");