aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/auto4.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/auto4.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/auto4.C27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/auto4.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/auto4.C
new file mode 100644
index 0000000..36144fd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/auto4.C
@@ -0,0 +1,27 @@
+// Testcase for deduction of std::initializer_list for auto.
+// { dg-do run { target c++11 } }
+
+#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');
+}