re PR c++/65790 (compilation error : receive std::index_sequence)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 9 Jul 2015 09:51:09 +0000 (09:51 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 9 Jul 2015 09:51:09 +0000 (09:51 +0000)
2015-07-09  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/65790
* g++.dg/cpp0x/vt-65790.C: New.

From-SVN: r225607

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/vt-65790.C [new file with mode: 0644]

index 49d6f2b..78dd30c 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-09  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/65790
+       * g++.dg/cpp0x/vt-65790.C: New.
+
 2015-07-09  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/66818
diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-65790.C b/gcc/testsuite/g++.dg/cpp0x/vt-65790.C
new file mode 100644 (file)
index 0000000..477e988
--- /dev/null
@@ -0,0 +1,35 @@
+// PR c++/65790
+// { dg-do compile { target c++11 } }
+
+extern "C" int printf(const char* ...);
+
+namespace std
+{
+  typedef decltype(sizeof(0)) size_t;
+
+  template<typename _Tp, _Tp... _Idx>
+    struct integer_sequence
+    {
+      typedef _Tp value_type;
+      static constexpr size_t size() { return sizeof...(_Idx); }
+    };
+
+  template<size_t... _Idx>
+    using index_sequence = integer_sequence<size_t, _Idx...>;
+}
+
+void g(std::size_t a, std::size_t b, std::size_t c)
+{
+  printf("%zu, %zu, %zu\n", a, b, c);
+}
+
+template <std::size_t... Seq>
+void f(std::index_sequence<Seq...>)
+{
+  g(Seq...);
+}
+
+int main()
+{
+  f(std::index_sequence<0, 1, 2>());
+}