20 : private A1, private A2 { };
28 template<typename T, typename U>
31 { return __is_base_of(T, U); }
33 template<typename T, typename U>
39 { return !!__is_base_of(T, U); }
42 template<typename T, typename U>
46 static const bool trait = __is_base_of(T, U);
49 template<typename T, typename U>
50 const bool My2<T, U>::trait;
52 template<typename T, typename U, bool b = __is_base_of(T, U)>
54 { static const bool trait = b; };
56 template<typename T, typename U, bool b>
57 const bool My3_help<T, U, b>::trait;
59 template<typename T, typename U>
65 { return My3_help<T, U>::trait; }
68 #define PTEST(T, U) (__is_base_of(T, U) && f<T, U>() \
69 && My<T, U>().f() && My2<T, U>::trait && My3<T, U>().f())
71 #define NTEST(T, U) (!__is_base_of(T, U) && !f<T, U>() \
72 && !My<T, U>().f() && !My2<T, U>::trait && !My3<T, U>().f())
76 assert (NTEST (int, A1));
77 assert (NTEST (A1, void));
78 assert (PTEST (A1, A1));
79 assert (NTEST (A1*, A1*));
80 assert (NTEST (A1&, A1&));
81 assert (PTEST (A1, B));
82 assert (NTEST (B, A1));
83 assert (PTEST (A1, C));
84 assert (PTEST (A2, C));
85 assert (NTEST (C, A1));
86 assert (PTEST (A1, const B));
87 assert (NTEST (const B, A1));
88 assert (PTEST (A1, volatile C));
89 assert (PTEST (volatile A2, const C));
90 assert (NTEST (const volatile C, A1));
91 assert (NTEST (U, U));