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: Re: C++ PATCH for c++/65646 (ICE after error specializing missing static data member)
Date: Thu, 23 Apr 2015 15:50:00 -0000	[thread overview]
Message-ID: <553914D5.8010805@redhat.com> (raw)
In-Reply-To: <551C1E71.9080501@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 465 bytes --]

On 04/01/2015 12:36 PM, Jason Merrill wrote:
> This testcase started crashing because the added call to
> check_explicit_specialization does a SET_DECL_TEMPLATE_SPECIALIZATION
> which wasn't happening previously, and then determine_visibility assumes
> that if DECL_USE_TEMPLATE is set, so is DECL_TEMPLATE_INFO.  Fixed for
> GCC 5 by avoiding the call if we aren't dealing with a member template.

And fixed for GCC 6 by adjusting check_explicit_specialization.



[-- Attachment #2: 65646-2.patch --]
[-- Type: text/x-patch, Size: 1259 bytes --]

commit a7205fbf919d0f460c278843159bb068745406dc
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 1 12:48:40 2015 -0400

    	PR c++/65646
    	* pt.c (check_explicit_specialization): Don't
    	SET_DECL_TEMPLATE_SPECIALIZATION for a variable with no template
    	headers.
    	* decl.c (grokvardecl): Revert earlier fix.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 29d6e73..6ec1579 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8210,9 +8210,7 @@ grokvardecl (tree type,
     DECL_INTERFACE_KNOWN (decl) = 1;
 
   // Handle explicit specializations and instantiations of variable templates.
-  if (orig_declarator
-      /* For GCC 5 fix 65646 this way.  */
-      && current_tmpl_spec_kind (template_count) != tsk_none)
+  if (orig_declarator)
     decl = check_explicit_specialization (orig_declarator, decl,
 					  template_count, 0);
 
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d45fe7c..ea0d3bc 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2424,7 +2424,7 @@ check_explicit_specialization (tree declarator,
   switch (tsk)
     {
     case tsk_none:
-      if (processing_specialization)
+      if (processing_specialization && TREE_CODE (decl) != VAR_DECL)
 	{
 	  specialization = 1;
 	  SET_DECL_TEMPLATE_SPECIALIZATION (decl);

      reply	other threads:[~2015-04-23 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 16:36 Jason Merrill
2015-04-23 15:50 ` Jason Merrill [this message]

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=553914D5.8010805@redhat.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).