// PR c++/58176 // { dg-do compile { target c++11 } } // Nil struct nil_ { constexpr nil_ () {} }; constexpr nil_ nil; // Cons template struct cons_ { using head_ = H; using tail_ = T; H head; T tail; constexpr cons_() {} constexpr cons_(H const &h, T const &t) : head(h), tail(t) {} }; template constexpr cons_ cons (H const &h, T const &t = nil) { return cons_(h,t); } // List template struct list_s; template struct list_s { using type = cons_::type>; }; template <> struct list_s<> { using type = nil_; }; template using list_ = typename list_s::type; constexpr nil_ list () { return nil; } template constexpr list_ list (H h, T... t) { return cons(h, list(t...)); } constexpr auto l1 = list("monkey", 123.4, cons(1, 2), nullptr);