From patchwork Wed Apr 30 09:15:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 344072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B059E1400AC for ; Wed, 30 Apr 2014 19:17:34 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=rxtoOSe2FSoX+a89QppmtCiOkArtxscCqmg+9nHHOkA RmocNExWyoMW3DO/aswF3aR3joJHPzC4eJnan/+EE2XtAzBXRIzTnIC9/lTKeGMM aZ91iycbCokNq8AGRsQ91AAJAFKyR3y8Byv2lyzl7lFeCBvzbxbmKfZsaV5jrO8s = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=gAhLu2ljxaYK1P56pFIJApbqOs4=; b=VKGsZRZDJkRieFiiP I6YBNIdYofywW+oPN0MzIgbxt+pqZNRj6Fba//ft7iVexCm12cixflWj7mKB9zlO VsZzSwacf08Dvl/P27qikREIFNJxITLOmMMJqkz1CQQUzDANVKFH1dFychkolMpi oCHLYSfU0hvxpMuXI1B/amy9qs= Received: (qmail 15736 invoked by alias); 30 Apr 2014 09:17:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 15722 invoked by uid 89); 30 Apr 2014 09:17:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 30 Apr 2014 09:17:24 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s3U9HL2q027784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 30 Apr 2014 09:17:21 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s3U9HJQW011984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 30 Apr 2014 09:17:20 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s3U9HJpZ027423; Wed, 30 Apr 2014 09:17:19 GMT Received: from [192.168.1.4] (/79.47.215.175) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 30 Apr 2014 02:17:19 -0700 Message-ID: <5360BF35.2010903@oracle.com> Date: Wed, 30 Apr 2014 11:15:33 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 60999 X-IsSubscribed: yes Hi, this regression unfortunately has to do with my fix for c++/57887, thus the code in maybe_begin_member_template_processing: if (nsdmi) decl = (CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl)) ? CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (decl)) : NULL_TREE); The check is true for the new testcase and we end up with an unsubstituted STATIC_CAST_EXPR which leads to an ICE in cxx_eval_constant_expression. Having tried a number of ideas (by now we have got quite a few testcases in this area), I think it makes sense to check uses_template_parms too on DECL_CONTEXT (decl): when it returns false I don't think we may run into uses of template parms a la c++/57887 and we are back to the status pre- that fix in nsdmi handling. Tested x86_64-linux. Thanks, Paolo. ///////////////////// /cp 2014-04-30 Paolo Carlini PR c++/60999 * pt.c (maybe_begin_member_template_processing): Use uses_template_parms. /testsuite 2014-04-30 Paolo Carlini PR c++/60999 * g++.dg/cpp0x/nsdmi-template9.C: New. Index: cp/pt.c =================================================================== --- cp/pt.c (revision 209916) +++ cp/pt.c (working copy) @@ -463,6 +463,7 @@ maybe_begin_member_template_processing (tree decl) if (nsdmi) decl = (CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl)) + && uses_template_parms (DECL_CONTEXT (decl)) ? CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (decl)) : NULL_TREE); Index: testsuite/g++.dg/cpp0x/nsdmi-template9.C =================================================================== --- testsuite/g++.dg/cpp0x/nsdmi-template9.C (revision 0) +++ testsuite/g++.dg/cpp0x/nsdmi-template9.C (working copy) @@ -0,0 +1,16 @@ +// PR c++/60999 +// { dg-do compile { target c++11 } } + +template +struct foo +{ +}; + +template<> +struct foo +{ + static constexpr int code = 42; + unsigned int bar = static_cast(code); +}; + +foo a;