re PR c++/63588 (ICE (segfault) on arm-linux-gnueabihf)
authorJason Merrill <jason@redhat.com>
Fri, 21 Nov 2014 21:34:54 +0000 (16:34 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 21 Nov 2014 21:34:54 +0000 (16:34 -0500)
PR c++/63588
* pt.c (uses_template_parms): Handle null argument.

From-SVN: r217948

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1y/var-templ15.C [new file with mode: 0644]

index 033ce7b74992d3921ee6d1d42995f2030aa85ff1..89d4ade46f9cf0a17675286744a6fcb5dbd2c29b 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-21  Jason Merrill  <jason@redhat.com>
+
+       PR c++/63588
+       * pt.c (uses_template_parms): Handle null argument.
+
 2014-11-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/63764
index 71b7af1c206ff8862cf8d72981c51e07eb49f5ac..1d6b916c003cd933912fbe4bf0dd601304025e03 100644 (file)
@@ -8294,6 +8294,9 @@ for_each_template_parm (tree t, tree_fn_t fn, void* data,
 int
 uses_template_parms (tree t)
 {
+  if (t == NULL_TREE)
+    return false;
+
   bool dependent_p;
   int saved_processing_template_decl;
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ15.C b/gcc/testsuite/g++.dg/cpp1y/var-templ15.C
new file mode 100644 (file)
index 0000000..7dd2dcd
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/63588
+// { dg-do compile { target c++14 } }
+
+template <class T> T elements;
+int i = elements <>;           // { dg-error "arguments" }