aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/decltype44.C
blob: 2b2e62213e2eafde2738ab41fa1212de1405ae84 (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
// PR c++/53307
// { dg-do compile { target c++11 } }

template <class...Ts> struct tuple{};

struct funct
{
  template <class T, class...argTs>
  T operator()(T arg1, argTs...)
  {
    return arg1;
  }
};

template <class...>class test;

template < template <class...> class tp,
	   class...arg1Ts,
	   class...arg2Ts> 
class test<tp<arg1Ts...>, tp<arg2Ts...>>
{
 public:
  template <class func>
    auto test_pass(func fun, arg2Ts...arg2s) 
    -> decltype(fun(arg2s...)) 
  {
    return fun(arg2s...);
  }

  template <class func, class...arg3Ts>
    auto testbug(func fun, arg2Ts...arg2s, arg3Ts...arg3s)
    -> decltype(fun(arg2s..., arg3s...)) 
  {
    return fun(arg2s..., arg3s...);
  }
};

int main()
{	
  test<tuple<>, tuple<char, int>> t;
  t.test_pass (funct(), 'a', 2);
  t.testbug (funct(), 'a', 2, "fine");
  t.testbug (funct(), 'a', 2);
}