re PR c++/64574 (ICE (stack overflow SEGV) with bad template specialization)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 6 Mar 2017 11:54:37 +0000 (11:54 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 6 Mar 2017 11:54:37 +0000 (11:54 +0000)
2017-03-06  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/64574
* g++.dg/template/crash125.C: New.

From-SVN: r245916

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

index 636cbee880395da7fcfa1d78b967aadefc746dbd..43c19c347950f74896fe72ca3d810a5d49cd6c19 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-06  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/64574
+       * g++.dg/template/crash125.C: New.
+
 2017-03-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/79812
diff --git a/gcc/testsuite/g++.dg/template/crash125.C b/gcc/testsuite/g++.dg/template/crash125.C
new file mode 100644 (file)
index 0000000..448f746
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/64574
+
+template<class T>
+class TraitCheckImpl;
+
+template<class T, class>
+class Swappable;
+template<class T, class=typename TraitCheckImpl<Swappable<T, void> >::Complete>
+class Swappable;
+
+template<class T>
+struct TraitCheckImpl<Swappable<T> > {
+    typedef void Complete;
+};
+
+Swappable<int> s;  // { dg-error "depth" }
+
+// { dg-prune-output "compilation terminated" }