aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/auto4.C
blob: 36144fd9aaec468b1daa8d313074f4e85c39cbe3 (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
// Testcase for deduction of std::initializer_list for auto.
// { dg-do run { target c++11 } }

#include <typeinfo>
#include <initializer_list>
extern "C" void abort();

template <class T>
void f (T t)
{
  auto ilt = { &t, &t };
  if (typeid(ilt) != typeid(std::initializer_list<T*>))
    abort();

  auto il = { 1, 2, 3 };
  if (typeid(il) != typeid(std::initializer_list<int>))
    abort();
}

int main()
{
  auto il = { 1, 2, 3 };
  if (typeid(il) != typeid(std::initializer_list<int>))
    abort();

  f('c');
}