summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/abi/lambda-tpl1.h
blob: 376c3f6a2f4ef15766c4e4cfc61e466f4e614248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
inline auto l_auto = [] (auto) {};

inline auto l_tpl = [] <typename T> (T) {};

inline auto l_tpl_auto = [] <typename T> (T, auto) {};

inline auto l_tpl_nt_ary = [] <int I> (int (&)[I]) {};

inline auto l_tpl_nt_auto = [] <auto I = 0> () {};

template<typename T, unsigned I> class U;

template<template<typename, unsigned> typename> class TPL {};
inline auto l_tpl_tpl = [] <template<typename, unsigned> typename T> (TPL<T> &) {};

template<template<template<typename, unsigned> typename> typename> class TPLTPL {};
inline auto l_tpl_tpl_tpl = []<template<template<typename, unsigned> typename> typename T> (TPLTPL<T> &) {};

inline auto l_var = []<typename... Args> (Args...) {};

#if FIXME // we fail to parse (&...) correctly
inline auto l_var2 = []<int... I> (int (&...)[I]) {};
#endif

template<int...I> class X {};
inline auto l_var3 = []<template<int...> typename T, int...I> (T<I...> &a) {};

template<template<typename, unsigned> typename...T> class Y{};
inline auto l_var4 = []<template<typename, unsigned> typename... T> (Y<T...> &a) {};

template<int I> inline void Fn ()
{
  auto l = []<typename T> (T) {};
  l (1);
}

void f () 
{
  l_auto (1);
  l_tpl (1);
  l_tpl_auto (1, 1);
  int ary[2];
  l_tpl_nt_ary (ary);
  l_tpl_nt_auto ();
  TPL<U> v;
  l_tpl_tpl (v);
  TPLTPL<TPL> u;
  l_tpl_tpl_tpl (u);
  l_var (1, 2, 3);
#if FIXME
  l_var2 (ary, ary);
#endif
  X<1,2,3> x;
  l_var3 (x);
  Y<U,U> y;
  l_var4 (y);

  Fn<1> ();

  auto l1 = []<typename T, T v = T(0)> (T a) {
    auto l2 = []<typename U> (T a, U b) {};

    l2 (a, v);
  };
  auto l3 = []<typename T>(U<T, 0> *, U<int, 0> *) {};

  l1 (1);
  l1 ('1');
  l3 ((U<char, 0> *)nullptr, nullptr);
}