Debian Codegraph @

gcc/testsuite/g++.dg/template/sfinae24.C

raw
1 // PR c++/44969
2
3 template<bool, typename T = void> struct enable_if { typedef T type; };
4 template<typename T> struct enable_if<false, T> { };
5
6 template<typename Tp, typename Arg1, typename Arg2>
7 class mini_is_constructible
8 {
9 typedef char one;
10 typedef struct { char arr[2]; } two;
11
12 template<typename Tp1, typename Arg1_, typename Arg2_>
13 static typename
14 enable_if<(sizeof(Tp1(Arg1_(), Arg2_()), 1) > 0), one>::type
15 test(int);
16
17 template<typename, typename, typename>
18 static two test(...);
19
20 public:
21 static const bool value = sizeof(test<Tp, Arg1, Arg2>(0)) == 1;
22 };
23
24 class A { };
25
26 int Test[mini_is_constructible<int, A, A>::value ? -1 : 1];