blob: d47bca4369dd43f4ea31c505779b22339d1e367f (
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
|
// Testcase for deduction of std::initializer_list for auto.
// { dg-do run }
// { dg-options "-std=c++0x" }
#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');
}
|