From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92852 invoked by alias); 1 Apr 2015 16:36:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 92837 invoked by uid 89); 1 Apr 2015 16:36:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 01 Apr 2015 16:36:07 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t31Ga5lf010753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 1 Apr 2015 12:36:06 -0400 Received: from [10.10.116.23] ([10.10.116.23]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t31Ga4hB004908 for ; Wed, 1 Apr 2015 12:36:05 -0400 Message-ID: <551C1E71.9080501@redhat.com> Date: Wed, 01 Apr 2015 16:36:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/65646 (ICE after error specializing missing static data member) Content-Type: multipart/mixed; boundary="------------000208050504040903090701" X-SW-Source: 2015-04/txt/msg00025.txt.bz2 This is a multi-part message in MIME format. --------------000208050504040903090701 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 395 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. --------------000208050504040903090701 Content-Type: text/x-patch; name="65646.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="65646.patch" Content-length: 1118 commit 5dbbdeda316eaa8f2b2a43fc28762f7d7ecca22c Author: Jason Merrill 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 class A {}; +template <> A<> &A<>::a; // { dg-error "" } --------------000208050504040903090701--