summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C
new file mode 100644
index 000000000..e422132af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C
@@ -0,0 +1,26 @@
+// Test for deduction of T as std::initializer_list. This isn't currently
+// supported by the working draft, but is necessary for perfect forwarding
+// of initializer-lists to things that can take a std::initializer_list.
+
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+#include <initializer_list>
+
+struct A
+{
+ A(std::initializer_list<int>) { }
+};
+
+void f (A a) { }
+
+template <class T>
+auto g (T&& t) -> decltype (f(t)) // { dg-warning "call" }
+{
+ return f(t);
+}
+
+int main()
+{
+ g({1}); // { dg-warning "deduc" }
+}