Skip to content

Commit 7c6f7ba

Browse files
committed
[clang][NFC] Use __is_base_of builtin in lieu of isBaseOfT and isBaseOfF
1 parent 9a3626d commit 7c6f7ba

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

clang/test/SemaCXX/type-traits.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,15 +2027,6 @@ template<typename T> struct CrazyDerived : T { };
20272027

20282028
class class_forward; // expected-note 2 {{forward declaration of 'class_forward'}}
20292029

2030-
template <typename Base, typename Derived>
2031-
void isBaseOfT() {
2032-
static_assert(__is_base_of(Base, Derived), "");
2033-
};
2034-
template <typename Base, typename Derived>
2035-
void isBaseOfF() {
2036-
static_assert(!__is_base_of(Base, Derived), "");
2037-
};
2038-
20392030
template <class T> class DerivedTemp : Base {};
20402031
template <class T> class NonderivedTemp {};
20412032
template <class T> class UndefinedTemp; // expected-note {{declared here}}
@@ -2079,14 +2070,14 @@ void is_base_of() {
20792070
static_assert(!__is_base_of(int, Empty), "");
20802071
static_assert(!__is_base_of(Union, int), "");
20812072

2082-
isBaseOfT<Base, Derived>();
2083-
isBaseOfF<Derived, Base>();
2073+
static_assert(__is_base_of(Base, Derived), "");
2074+
static_assert(!__is_base_of(Derived, Base), "");
20842075

2085-
isBaseOfT<Base, CrazyDerived<Base> >();
2086-
isBaseOfF<CrazyDerived<Base>, Base>();
2076+
static_assert(__is_base_of(Base, CrazyDerived<Base>), "");
2077+
static_assert(!__is_base_of(CrazyDerived<Base>, Base), "");
20872078

2088-
isBaseOfT<BaseA<int>, DerivedB<int> >();
2089-
isBaseOfF<DerivedB<int>, BaseA<int> >();
2079+
static_assert(__is_base_of(BaseA<int>, DerivedB<int>), "");
2080+
static_assert(!__is_base_of(DerivedB<int>, BaseA<int>), "");
20902081
}
20912082

20922083
template<class T, class U>

0 commit comments

Comments
 (0)