* C++ PATCH for c++/84376, ICE with missing template arguments
@ 2018-02-15 19:46 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2018-02-15 19:46 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 133 bytes --]
Here we are asked deduction_guide_p about a TEMPLATE_ID_EXPR; give the
right answer.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 84376.diff --]
[-- Type: text/plain, Size: 1038 bytes --]
commit 6ef5c80e09542b55e5dc4e66db87c78adfc0a266
Author: Jason Merrill <jason@redhat.com>
Date: Thu Feb 15 13:37:58 2018 -0500
PR c++/84376 - ICE with omitted template arguments.
* pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index cd1aed8d677..268cfe5a454 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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
index 00000000000..3e47f58e698
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction47.C
@@ -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" }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-02-15 19:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15 19:46 C++ PATCH for c++/84376, ICE with missing template arguments Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).