1 // { dg-options "-std=gnu++11" }
4 // Copyright (C) 2013 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
, AbstractClass
,
51 AbstractClass
>(true), "");
52 static_assert(test_relationship
<is_base_of
, ClassType
,
53 DerivedType
>(true), "");
54 static_assert(test_relationship
<is_base_of
, ClassType
,
55 const DerivedType
>(true), "");
56 static_assert(test_relationship
<is_base_of
, volatile ClassType
,
57 volatile DerivedType
>(true), "");
58 static_assert(test_relationship
<is_base_of
, PolymorphicClass
,
59 DerivedPolymorphic
>(true), "");
60 static_assert(test_relationship
<is_base_of
, HiddenCons
,
61 DerivedHiddenCons
>(true), "");
62 static_assert(test_relationship
<is_base_of
, HiddenCons
,
63 MultiDerivedHiddenCons
>(true), "");
64 static_assert(test_relationship
<is_base_of
, ClassType
,
65 MultiDerivedHiddenCons
>(true), "");
68 static_assert(test_relationship
<is_base_of
, int, int>(false), "");
69 static_assert(test_relationship
<is_base_of
, EnumType
, EnumType
>(false), "");
70 static_assert(test_relationship
<is_base_of
, UnionType
, UnionType
>(false), "");
71 static_assert(test_relationship
<is_base_of
, int, const int>(false), "");
72 static_assert(test_relationship
<is_base_of
, volatile UnionType
,
73 UnionType
>(false), "");
74 static_assert(test_relationship
<is_base_of
, int&, ClassType
>(false), "");
75 static_assert(test_relationship
<is_base_of
, AbstractClass
,
76 ClassType
>(false), "");
77 static_assert(test_relationship
<is_base_of
, ClassType
,
78 AbstractClass
>(false), "");
79 static_assert(test_relationship
<is_base_of
, DerivedType
,
80 ClassType
>(false), "");
81 static_assert(test_relationship
<is_base_of
, DerivedPolymorphic
,
82 PolymorphicClass
>(false), "");
83 static_assert(test_relationship
<is_base_of
, DerivedHiddenCons
,
84 HiddenCons
>(false), "");
85 static_assert(test_relationship
<is_base_of
, MultiDerivedHiddenCons
,
86 HiddenCons
>(false), "");
87 static_assert(test_relationship
<is_base_of
, MultiDerivedHiddenCons
,
88 ClassType
>(false), "");