public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/65646 (ICE after error specializing missing static data member)
@ 2015-04-01 16:36 Jason Merrill
  2015-04-23 15:50 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Merrill @ 2015-04-01 16:36 UTC (permalink / raw)
  To: gcc-patches List

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

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.

Tested x86_64-pc-linux-gnu, applying to trunk.

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

commit 5dbbdeda316eaa8f2b2a43fc28762f7d7ecca22c
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 1 10:14:53 2015 -0400

    	PR c++/65646
    	* decl.c (grokvardecl): Don't call check_explicit_specialization
    	for non-template members of a class template.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f05aefa..31b8e0c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -8210,7 +8210,9 @@ grokvardecl (tree type,
     DECL_INTERFACE_KNOWN (decl) = 1;
 
   // Handle explicit specializations and instantiations of variable templates.
-  if (orig_declarator)
+  if (orig_declarator
+      /* For GCC 5 fix 65646 this way.  */
+      && current_tmpl_spec_kind (template_count) != tsk_none)
     decl = check_explicit_specialization (orig_declarator, decl,
 					  template_count, 0);
 
diff --git a/gcc/testsuite/g++.dg/template/static36.C b/gcc/testsuite/g++.dg/template/static36.C
new file mode 100644
index 0000000..36c48b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/static36.C
@@ -0,0 +1,4 @@
+// PR c++/65646
+
+template <typename = int> class A {};
+template <> A<> &A<>::a;	// { dg-error "" }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-23 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01 16:36 C++ PATCH for c++/65646 (ICE after error specializing missing static data member) Jason Merrill
2015-04-23 15:50 ` 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).