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//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03
10
11// "support/test_convertible.h"
12
13#include "test_convertible.h"
14
15#include "test_macros.h"
16
17struct ImplicitDefault {
18 ImplicitDefault() {}
19};
20static_assert(test_convertible<ImplicitDefault>(), "Must be convertible");
21
22struct ExplicitDefault {
23 explicit ExplicitDefault() {}
24};
25static_assert(!test_convertible<ExplicitDefault>(), "Must not be convertible");
26
27struct ImplicitInt {
28 ImplicitInt(int) {}
29};
30static_assert(test_convertible<ImplicitInt, int>(), "Must be convertible");
31
32struct ExplicitInt {
33 explicit ExplicitInt(int) {}
34};
35static_assert(!test_convertible<ExplicitInt, int>(), "Must not be convertible");
36
37struct ImplicitCopy {
38 ImplicitCopy(ImplicitCopy const&) {}
39};
40static_assert(test_convertible<ImplicitCopy, ImplicitCopy>(), "Must be convertible");
41
42struct ExplicitCopy {
43 explicit ExplicitCopy(ExplicitCopy const&) {}
44};
45static_assert(!test_convertible<ExplicitCopy, ExplicitCopy>(), "Must not be convertible");
46
47struct ImplicitMove {
48 ImplicitMove(ImplicitMove&&) {}
49};
50static_assert(test_convertible<ImplicitMove, ImplicitMove>(), "Must be convertible");
51
52struct ExplicitMove {
53 explicit ExplicitMove(ExplicitMove&&) {}
54};
55static_assert(!test_convertible<ExplicitMove, ExplicitMove>(), "Must not be convertible");
56
57struct ImplicitArgs {
58 ImplicitArgs(int, int, int) {}
59};
60static_assert(test_convertible<ImplicitArgs, int, int, int>(), "Must be convertible");
61
62struct ExplicitArgs {
63 explicit ExplicitArgs(int, int, int) {}
64};
65static_assert(!test_convertible<ExplicitArgs, int, int, int>(), "Must not be convertible");
66
67int main(int, char**) {
68 // Nothing to do
69
70 return 0;
71}
72

source code of libcxx/test/support/test.support/test_convertible_header.pass.cpp