Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/auto4.C

raw
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 }