public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: C++ PATCH for c++/84376, ICE with missing template arguments
Date: Thu, 15 Feb 2018 19:46:00 -0000	[thread overview]
Message-ID: <CADzB+2nVWEb6Tkf1sAxLNqRNAnbp-cSwRq4g7Nf4cT7BG8VJWg@mail.gmail.com> (raw)

[-- 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" }

                 reply	other threads:[~2018-02-15 19:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADzB+2nVWEb6Tkf1sAxLNqRNAnbp-cSwRq4g7Nf4cT7BG8VJWg@mail.gmail.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).