re PR c++/53401 ([C++11] internal compiler error: Segmentation fault on infinite...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 23 May 2016 09:23:42 +0000 (09:23 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 23 May 2016 09:23:42 +0000 (09:23 +0000)
2016-05-23  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53401
* g++.dg/cpp0x/decltype64.C: New.

From-SVN: r236581

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

index 64b691dd0e45397f528d61078f1de81492b7ebdd..215de618ca14c2db0eb4cddcd922f4ce6a94acaa 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-23  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53401
+       * g++.dg/cpp0x/decltype64.C: New.
+
 2016-05-23  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gcc.target/aarch64/advsimd-intrinsics/vreinterpret.c: Add fp16 tests.
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype64.C b/gcc/testsuite/g++.dg/cpp0x/decltype64.C
new file mode 100644 (file)
index 0000000..46d1859
--- /dev/null
@@ -0,0 +1,32 @@
+// PR c++/53401
+// { dg-do compile { target c++11 } }
+
+template<int I>
+struct index
+{};
+
+constexpr int recursive_impl(index<0u>)
+{
+  return 0;
+}
+
+template<int N>
+constexpr auto recursive_impl(index<N>)
+  -> decltype(recursive_impl(index<N - 1>()))  // { dg-error "depth" }
+{
+  return recursive_impl(index<N - 1>());
+}
+
+template<int N>
+constexpr auto recursive()
+  -> decltype(recursive_impl(index<N>()))
+{
+  return recursive_impl(index<N>());
+}
+
+void f(int i)
+{
+  recursive<1>();   // { dg-message "from here" }
+}
+
+// { dg-prune-output "compilation terminated" }