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 
17 struct ImplicitDefault {
ImplicitDefaultImplicitDefault18   ImplicitDefault() {}
19 };
20 static_assert(test_convertible<ImplicitDefault>(), "Must be convertible");
21 
22 struct ExplicitDefault {
ExplicitDefaultExplicitDefault23   explicit ExplicitDefault() {}
24 };
25 static_assert(!test_convertible<ExplicitDefault>(), "Must not be convertible");
26 
27 struct ImplicitInt {
ImplicitIntImplicitInt28   ImplicitInt(int) {}
29 };
30 static_assert(test_convertible<ImplicitInt, int>(), "Must be convertible");
31 
32 struct ExplicitInt {
ExplicitIntExplicitInt33   explicit ExplicitInt(int) {}
34 };
35 static_assert(!test_convertible<ExplicitInt, int>(), "Must not be convertible");
36 
37 struct ImplicitCopy {
ImplicitCopyImplicitCopy38   ImplicitCopy(ImplicitCopy const&) {}
39 };
40 static_assert(test_convertible<ImplicitCopy, ImplicitCopy>(), "Must be convertible");
41 
42 struct ExplicitCopy {
ExplicitCopyExplicitCopy43   explicit ExplicitCopy(ExplicitCopy const&) {}
44 };
45 static_assert(!test_convertible<ExplicitCopy, ExplicitCopy>(), "Must not be convertible");
46 
47 struct ImplicitMove {
ImplicitMoveImplicitMove48   ImplicitMove(ImplicitMove&&) {}
49 };
50 static_assert(test_convertible<ImplicitMove, ImplicitMove>(), "Must be convertible");
51 
52 struct ExplicitMove {
ExplicitMoveExplicitMove53   explicit ExplicitMove(ExplicitMove&&) {}
54 };
55 static_assert(!test_convertible<ExplicitMove, ExplicitMove>(), "Must not be convertible");
56 
57 struct ImplicitArgs {
ImplicitArgsImplicitArgs58   ImplicitArgs(int, int, int) {}
59 };
60 static_assert(test_convertible<ImplicitArgs, int, int, int>(), "Must be convertible");
61 
62 struct ExplicitArgs {
ExplicitArgsExplicitArgs63   explicit ExplicitArgs(int, int, int) {}
64 };
65 static_assert(!test_convertible<ExplicitArgs, int, int, int>(), "Must not be convertible");
66 
main(int,char **)67 int main(int, char**) {
68     // Nothing to do
69 
70   return 0;
71 }
72