This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for c++/63588 (ICE with empty template args to variable template)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 21 Nov 2014 16:33:52 -0500
- Subject: C++ PATCH for c++/63588 (ICE with empty template args to variable template)
- Authentication-results: sourceware.org; auth=none
uses_template_parms ought to be able to deal with NULL_TREE.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit 3a85a7bd7ea664fb594843433c51f3b6cbb320d3
Author: Jason Merrill <jason@redhat.com>
Date: Fri Nov 21 13:46:34 2014 -0500
PR c++/63588
* pt.c (uses_template_parms): Handle null argument.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 71b7af1..1d6b916 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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
index 0000000..7dd2dcd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ15.C
@@ -0,0 +1,5 @@
+// PR c++/63588
+// { dg-do compile { target c++14 } }
+
+template <class T> T elements;
+int i = elements <>; // { dg-error "arguments" }