2 // { dg-do compile { target c++14 } }
5 template <typename _Tp> struct __decay_and_strip { typedef _Tp __type; };
6 template <int> struct enable_if { typedef int type; };
7 template <typename _Head> struct _Head_base {
8 constexpr _Head_base(_Head) {}
10 template <unsigned long, typename...> struct _Tuple_impl;
11 template <unsigned long _Idx, typename _Head, typename... _Tail>
12 struct _Tuple_impl<_Idx, _Head, _Tail...> : _Tuple_impl<1, _Tail...>, // { dg-warning "direct base" }
14 typedef _Tuple_impl<1, _Tail...> _Inherited;
15 typedef _Head_base<_Head> _Base;
16 constexpr _Tuple_impl(_Head __head, _Tail... __tail)
17 : _Inherited(__tail...), _Base(__head) {}
18 _Tuple_impl(const _Tuple_impl &) = default;
19 _Tuple_impl(_Tuple_impl &&);
21 template <unsigned long _Idx, typename _Head>
22 struct _Tuple_impl<_Idx, _Head> : _Head_base<_Head> {
23 typedef _Head_base<_Head> _Base;
24 constexpr _Tuple_impl(_Head __head) : _Base(__head) {}
26 template <int> struct _TC {
27 static constexpr bool _NotSameTuple() { return true; }
29 template <typename... _Elements> class tuple : _Tuple_impl<0, _Elements...> {
30 typedef _Tuple_impl<0, _Elements...> _Inherited;
33 template <typename... _UElements,
34 enable_if<_TC<1>::_NotSameTuple()>::type = false>
35 constexpr tuple(_UElements... __elements) : _Inherited(__elements...) {}
36 tuple(const tuple &) = default;
38 template <typename... _Elements>
39 constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
40 make_tuple(_Elements... __args) {
41 typedef tuple<typename __decay_and_strip<_Elements>::__type...> __result_type;
42 return __result_type(__args...);
46 template <typename... Tuples> constexpr auto flatten(Tuples... tuples) {
47 auto all = std::make_tuple(tuples...);
51 constexpr auto fail = flatten(any_udt{}, any_udt{});