PR c++/84376 - ICE with omitted template arguments.
authorJason Merrill <jason@redhat.com>
Thu, 15 Feb 2018 19:46:13 +0000 (14:46 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 15 Feb 2018 19:46:13 +0000 (14:46 -0500)
* pt.c (dguide_name_p): Check for IDENTIFIER_NODE.

From-SVN: r257706

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1z/class-deduction47.C [new file with mode: 0644]

index 5ecc8ab2672bc46a980c0c9b9fbb7e1341f33e04..58073748315b8c01a03010e2c96cfdcbc45e5651 100644 (file)
@@ -1,5 +1,8 @@
 2018-02-15  Jason Merrill  <jason@redhat.com>
 
+       PR c++/84376 - ICE with omitted template arguments.
+       * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
+
        PR c++/84368 - wrong error with local variable in variadic lambda.
        * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
        local_specializations.
index cd1aed8d677a075071b5d9c52f2dd76f755e0100..268cfe5a4548b6ab9e9306423c57b48dfb68bacd 100644 (file)
@@ -25454,7 +25454,8 @@ dguide_name (tree tmpl)
 bool
 dguide_name_p (tree name)
 {
-  return (TREE_TYPE (name)
+  return (TREE_CODE (name) == IDENTIFIER_NODE
+         && TREE_TYPE (name)
          && !strncmp (IDENTIFIER_POINTER (name), dguide_base,
                       strlen (dguide_base)));
 }
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction47.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction47.C
new file mode 100644 (file)
index 0000000..3e47f58
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/84376
+
+template<int> struct A {};
+
+template<typename T> T foo() { return T(); }
+
+template<> A foo<A>();         // { dg-error "A" }