1// PR c++/44907
2
3struct A { };
4
5struct B
6: public A { };
7
8struct C
9: public A { };
10
11struct D
12: public B, public C { };
13
14template<bool, typename T = void> struct enable_if { typedef T type; };
15template<typename T> struct enable_if<false, T> { };
16
17template<typename From, typename To>
18  class mini_is_convertible
19  {
20    typedef char one;
21    typedef struct { char arr[2]; } two;
22
23    template<typename To1>
24      static void test_aux(To1);
25
26    template<typename To1, typename From1>
27      static typename
28      enable_if<(sizeof(test_aux<To1>(From1()), 1) > 0), one>::type
29      test(int);
30
31    template<typename, typename>
32      static two test(...);
33
34    public:
35      static const bool value = sizeof(test<To, From>(0)) == 1;
36  };
37
38template<typename From, typename To>
39  const bool mini_is_convertible<From, To>::value;
40
41int Test1[mini_is_convertible<D*, A*>::value ? -1 : 1];
42int Test2[mini_is_convertible<A*, D*>::value ? -1 : 1];
43int Test3[mini_is_convertible<D, A>::value ? -1 : 1];
44int Test4[mini_is_convertible<A, D>::value ? -1 : 1];
45