]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/55843 (ICE after exceeding template instantiation depth)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 22 Jan 2016 11:03:54 +0000 (11:03 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 22 Jan 2016 11:03:54 +0000 (11:03 +0000)
2016-01-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/55843
* g++.dg/template/pr55843.C: New.

From-SVN: r232721

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

index cdffd2413691386e3e7a762f3ab011f17d88d7df..29a048df7ffa60986204e2f219350ae582320266 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/55843
+       * g++.dg/template/pr55843.C: New.
+
 2016-01-22  Alan Lawrence  <alan.lawrence@arm.com>
 
        PR testsuite/66877
diff --git a/gcc/testsuite/g++.dg/template/pr55843.C b/gcc/testsuite/g++.dg/template/pr55843.C
new file mode 100644 (file)
index 0000000..e1691d5
--- /dev/null
@@ -0,0 +1,27 @@
+// { dg-options "-ftemplate-depth-8" }
+
+template< typename T > struct type_wrapper {
+};
+typedef char (&yes_tag)[2];
+template<bool b> struct if_c {
+};
+template< typename T > struct has_type {
+  struct gcc_3_2_wknd {
+    template< typename U > static yes_tag test( type_wrapper<U> const volatile*
+, type_wrapper<typename U::type>* = 0 );
+  };
+  typedef type_wrapper<T> t_;
+  static const bool value = sizeof(gcc_3_2_wknd::test(static_cast<t_*>(0))) ==
+sizeof(yes_tag);
+};
+template <class K, class T, class=void> struct Get_type {
+};
+struct FT_tag {};
+struct RT_tag {};
+template <class K> struct Get_type<K, RT_tag, typename if_c<
+!has_type<Get_type<K, FT_tag> >::value >::type> { };
+template <class K> struct Get_type<K, FT_tag, typename if_c<
+!has_type<Get_type<K, RT_tag> >::value >::type> { };  // { dg-error "depth" }
+typedef Get_type<int, FT_tag>::type P;
+
+// { dg-prune-output "compilation terminated" }