• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++98, c++03
11 
12 // "support/test_convertible.hpp"
13 
14 #include "test_convertible.hpp"
15 
16 struct ImplicitDefault {
ImplicitDefaultImplicitDefault17   ImplicitDefault() {}
18 };
19 static_assert(test_convertible<ImplicitDefault>(), "Must be convertible");
20 
21 struct ExplicitDefault {
ExplicitDefaultExplicitDefault22   explicit ExplicitDefault() {}
23 };
24 static_assert(!test_convertible<ExplicitDefault>(), "Must not be convertible");
25 
26 struct ImplicitInt {
ImplicitIntImplicitInt27   ImplicitInt(int) {}
28 };
29 static_assert(test_convertible<ImplicitInt, int>(), "Must be convertible");
30 
31 struct ExplicitInt {
ExplicitIntExplicitInt32   explicit ExplicitInt(int) {}
33 };
34 static_assert(!test_convertible<ExplicitInt, int>(), "Must not be convertible");
35 
36 struct ImplicitCopy {
ImplicitCopyImplicitCopy37   ImplicitCopy(ImplicitCopy const&) {}
38 };
39 static_assert(test_convertible<ImplicitCopy, ImplicitCopy>(), "Must be convertible");
40 
41 struct ExplicitCopy {
ExplicitCopyExplicitCopy42   explicit ExplicitCopy(ExplicitCopy const&) {}
43 };
44 static_assert(!test_convertible<ExplicitCopy, ExplicitCopy>(), "Must not be convertible");
45 
46 struct ImplicitMove {
ImplicitMoveImplicitMove47   ImplicitMove(ImplicitMove&&) {}
48 };
49 static_assert(test_convertible<ImplicitMove, ImplicitMove>(), "Must be convertible");
50 
51 struct ExplicitMove {
ExplicitMoveExplicitMove52   explicit ExplicitMove(ExplicitMove&&) {}
53 };
54 static_assert(!test_convertible<ExplicitMove, ExplicitMove>(), "Must not be convertible");
55 
56 struct ImplicitArgs {
ImplicitArgsImplicitArgs57   ImplicitArgs(int, int, int) {}
58 };
59 static_assert(test_convertible<ImplicitArgs, int, int, int>(), "Must be convertible");
60 
61 struct ExplicitArgs {
ExplicitArgsExplicitArgs62   explicit ExplicitArgs(int, int, int) {}
63 };
64 static_assert(!test_convertible<ExplicitArgs, int, int, int>(), "Must not be convertible");
65 
main()66 int main() {
67     // Nothing to do
68 }
69