OSDN Git Service

PR c++/37256
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / auto4.C
1 // Testcase for deduction of std::initializer_list for auto.
2 // { dg-do run }
3 // { dg-options "-std=c++0x" }
4
5 #include <typeinfo>
6 #include <initializer_list>
7 extern "C" void abort();
8
9 template <class T>
10 void f (T t)
11 {
12   auto ilt = { &t, &t };
13   if (typeid(ilt) != typeid(std::initializer_list<T*>))
14     abort();
15
16   auto il = { 1, 2, 3 };
17   if (typeid(il) != typeid(std::initializer_list<int>))
18     abort();
19 }
20
21 int main()
22 {
23   auto il = { 1, 2, 3 };
24   if (typeid(il) != typeid(std::initializer_list<int>))
25     abort();
26
27   f('c');
28 }