aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C
blob: 6ae32a6c55df095eab8b20419a96af33c15d72d3 (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
// Test for deduction of T as std::initializer_list.  This isn't currently
// supported by the working draft, but is necessary for perfect forwarding
// of initializer-lists to things that can take a std::initializer_list.

// { dg-options "-fdeduce-init-list" }
// { dg-do run { target c++11 } }

#include <initializer_list>

struct A
{
  A(std::initializer_list<int>) { }
};

void f (A a) { }

template <class T>
auto g (T&& t) -> decltype (f(t)) // { dg-warning "call" }
{
  return f(t);
}

int main()
{
  g({1});			// { dg-warning "deduc" }
}

// { dg-prune-output "-fno-deduce-init-list" }