* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / nullptr30.C
blob3673999d8843bcfb997eadd67fdf8190186d7668
1 // PR c++/58176
2 // { dg-do compile { target c++11 } }
4 // Nil
5 struct nil_ { constexpr nil_ () {} };
6 constexpr nil_ nil;
8 // Cons
9 template <class H, class T = nil_>
10 struct cons_ {
11     using head_ = H;
12     using tail_ = T;
14     H head;
15     T tail;
17     constexpr cons_() {}
18     constexpr cons_(H const &h, T const &t) : head(h), tail(t) {}
20 template <class H, class T = nil_>
21 constexpr cons_<H, T> cons (H const &h, T const &t = nil) { return
22 cons_<H,T>(h,t); }
24 // List
25 template <class... T> struct list_s;
26 template <class H, class... T>
27 struct list_s<H, T...> {
28     using type = cons_<H, typename list_s<T...>::type>;
30 template <>
31 struct list_s<> {
32     using type = nil_;
34 template <class... T>
35 using list_ = typename list_s<T...>::type;
36 constexpr nil_ list () { return nil; }
37 template <class H, class... T>
38 constexpr list_<H, T...> list (H h, T... t) { return cons(h, list(t...)); }
40 constexpr auto l1 = list("monkey", 123.4, cons(1, 2), nullptr);