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 // "support/test_convertible.h"
13 #include "test_convertible.h"
15 #include "test_macros.h"
17 struct ImplicitDefault
{
20 static_assert(test_convertible
<ImplicitDefault
>(), "Must be convertible");
22 struct ExplicitDefault
{
23 explicit ExplicitDefault() {}
25 static_assert(!test_convertible
<ExplicitDefault
>(), "Must not be convertible");
30 static_assert(test_convertible
<ImplicitInt
, int>(), "Must be convertible");
33 explicit ExplicitInt(int) {}
35 static_assert(!test_convertible
<ExplicitInt
, int>(), "Must not be convertible");
38 ImplicitCopy(ImplicitCopy
const&) {}
40 static_assert(test_convertible
<ImplicitCopy
, ImplicitCopy
>(), "Must be convertible");
43 explicit ExplicitCopy(ExplicitCopy
const&) {}
45 static_assert(!test_convertible
<ExplicitCopy
, ExplicitCopy
>(), "Must not be convertible");
48 ImplicitMove(ImplicitMove
&&) {}
50 static_assert(test_convertible
<ImplicitMove
, ImplicitMove
>(), "Must be convertible");
53 explicit ExplicitMove(ExplicitMove
&&) {}
55 static_assert(!test_convertible
<ExplicitMove
, ExplicitMove
>(), "Must not be convertible");
58 ImplicitArgs(int, int, int) {}
60 static_assert(test_convertible
<ImplicitArgs
, int, int, int>(), "Must be convertible");
63 explicit ExplicitArgs(int, int, int) {}
65 static_assert(!test_convertible
<ExplicitArgs
, int, int, int>(), "Must not be convertible");
67 int main(int, char**) {