2 // { dg-do compile { target c++11 } }
4 #include <initializer_list>
5 template <class T, class U> struct same_type;
6 template <class T> struct same_type<T,T> {};
8 auto x1 = { 1, 2 }; // decltype(x1) is std::initializer_list<int>
9 same_type<decltype(x1),std::initializer_list<int>> s1;
10 auto x4 = { 3 }; // decltype(x4) is std::initializer_list<int>
11 same_type<decltype(x4),std::initializer_list<int>> s4;
12 auto x5{ 3 }; // decltype(x5) is int
13 same_type<decltype(x5),int> s5;
14 auto x2 = { 1, 2.0 }; // { dg-error "initializer_list" } cannot deduce element type
15 auto x3{ 1, 2 }; // { dg-error "one element" } not a single element