1 // { dg-options "-std=gnu++11" }
4 // Copyright (C) 2013-2014 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
21 #include <type_traits>
22 #include <testsuite_tr1.h>
27 HiddenCons(const HiddenCons
&);
30 class DerivedHiddenCons
34 DerivedHiddenCons(const DerivedHiddenCons
&);
37 class MultiDerivedHiddenCons
38 : private HiddenCons
, private __gnu_test::ClassType
40 MultiDerivedHiddenCons();
41 MultiDerivedHiddenCons(const MultiDerivedHiddenCons
&);
46 using std::is_base_of
;
47 using namespace __gnu_test
;
50 static_assert(test_relationship
<is_base_of
, volatile ClassType
,
51 ClassType
>(true), "");
52 static_assert(test_relationship
<is_base_of
, AbstractClass
,
53 AbstractClass
>(true), "");
54 static_assert(test_relationship
<is_base_of
, ClassType
,
55 DerivedType
>(true), "");
56 static_assert(test_relationship
<is_base_of
, ClassType
,
57 const DerivedType
>(true), "");
58 static_assert(test_relationship
<is_base_of
, volatile ClassType
,
59 volatile DerivedType
>(true), "");
60 static_assert(test_relationship
<is_base_of
, PolymorphicClass
,
61 DerivedPolymorphic
>(true), "");
62 static_assert(test_relationship
<is_base_of
, HiddenCons
,
63 DerivedHiddenCons
>(true), "");
64 static_assert(test_relationship
<is_base_of
, HiddenCons
,
65 MultiDerivedHiddenCons
>(true), "");
66 static_assert(test_relationship
<is_base_of
, ClassType
,
67 MultiDerivedHiddenCons
>(true), "");
70 static_assert(test_relationship
<is_base_of
, int, int>(false), "");
71 static_assert(test_relationship
<is_base_of
, EnumType
, EnumType
>(false), "");
72 static_assert(test_relationship
<is_base_of
, UnionType
, UnionType
>(false), "");
73 static_assert(test_relationship
<is_base_of
, int, const int>(false), "");
74 static_assert(test_relationship
<is_base_of
, volatile UnionType
,
75 UnionType
>(false), "");
76 static_assert(test_relationship
<is_base_of
, int&, ClassType
>(false), "");
77 static_assert(test_relationship
<is_base_of
, AbstractClass
,
78 ClassType
>(false), "");
79 static_assert(test_relationship
<is_base_of
, ClassType
,
80 AbstractClass
>(false), "");
81 static_assert(test_relationship
<is_base_of
, DerivedType
,
82 ClassType
>(false), "");
83 static_assert(test_relationship
<is_base_of
, DerivedPolymorphic
,
84 PolymorphicClass
>(false), "");
85 static_assert(test_relationship
<is_base_of
, DerivedHiddenCons
,
86 HiddenCons
>(false), "");
87 static_assert(test_relationship
<is_base_of
, MultiDerivedHiddenCons
,
88 HiddenCons
>(false), "");
89 static_assert(test_relationship
<is_base_of
, MultiDerivedHiddenCons
,
90 ClassType
>(false), "");