re PR middle-end/71387 (ICE in emit_move_insn, at expr.c:3418 with -Og)
[platform/upstream/gcc.git] / gcc / testsuite / g++.dg / cpp0x / auto4.C
1 // Testcase for deduction of std::initializer_list for auto.
2 // { dg-do run { target c++11 } }
3
4 #include <typeinfo>
5 #include <initializer_list>
6 extern "C" void abort();
7
8 template <class T>
9 void f (T t)
10 {
11   auto ilt = { &t, &t };
12   if (typeid(ilt) != typeid(std::initializer_list<T*>))
13     abort();
14
15   auto il = { 1, 2, 3 };
16   if (typeid(il) != typeid(std::initializer_list<int>))
17     abort();
18 }
19
20 int main()
21 {
22   auto il = { 1, 2, 3 };
23   if (typeid(il) != typeid(std::initializer_list<int>))
24     abort();
25
26   f('c');
27 }