Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/variadic-alias4.C

raw
1 // PR c++/104008
2 // { dg-do compile { target c++11 } }
3 // Differs from variadic-alias3.C only in the pattern of a pack expansion
4 // in line 34. But it's important to check that we also deal with more
5 // complex patterns.
6
7 template <typename...> struct conjunction;
8 template <typename...> struct disjunction;
9 template <typename, typename> struct is_same;
10 template <bool> struct enable_if;
11 template <bool _Cond> using enable_if_t = typename enable_if<_Cond>::type;
12 struct B;
13 struct __uniq_ptr_impl {
14 struct _Ptr {
15 using type = B *;
16 };
17 using pointer = _Ptr::type;
18 };
19 struct unique_ptr {
20 using pointer = __uniq_ptr_impl::pointer;
21 unique_ptr(pointer);
22 };
23 template <typename T, typename... Ts>
24 using IsOneOf = disjunction<is_same<T, Ts>...>;
25
26 template <typename...> struct any_badge;
27
28 struct badge {
29 badge(any_badge<>);
30 badge();
31 };
32
33 template <typename...> struct any_badge {
34 template <typename... OtherHolders,
35 enable_if_t<conjunction<IsOneOf<OtherHolders>&...>::value>>
36 any_badge();
37 };
38
39 template <typename, typename... _Args> unique_ptr make_unique(_Args... __args);
40
41 struct B {
42 B(badge);
43 unique_ptr b_ = make_unique<B>(badge{});
44 };
45
46 template <typename, typename... _Args> unique_ptr make_unique(_Args... __args) {
47 return new B(__args...);
48 }