From patchwork Mon Feb 26 10:19:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 877769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473831-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="UdWtnJVK"; dkim-atps=neutral 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 3zqdHM5VQyz9s2L for ; Mon, 26 Feb 2018 21:24:47 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=bv1R5tOKaY0yxbjKVH7ftdujX/vf3kItgcjen5QX5aAiD2RFzl bDetP5ifEI+3D45iyJqCksaZoOUunuV1zuGn5W4peUuijUEwMbTDauqS6OzBKotX JBdG9RspROfg5jr2I9QdKtTpkj2P0DcZGc41P7DkjE2gZY9/YcXMM7fbU= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=sjglvyCkMtElG5bCEAo/7ZKcD6Q=; b=UdWtnJVKdRRYshwHMr9p lWpo6/54Wz8SlFXIVrLZGyCyVnn/y9NiPWU1oErS0pcqztHfbqKecvGW9Fg8d3Tg kWA6lm2Ry7OsAXha19dKxoOYHq2q0CEOFCcVGNdLnb2voBLT/lcIMRdNfKsniwsx hFpg8gk5LOAObJXSdk1Y9vY= Received: (qmail 52272 invoked by alias); 26 Feb 2018 10:24:40 -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 52258 invoked by uid 89); 26 Feb 2018 10:24:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*RU:192.168.1.4, Hx-spam-relays-external:192.168.1.4 X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Feb 2018 10:24:37 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1QALdcD019104; Mon, 26 Feb 2018 10:24:34 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2gcgaqr254-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2018 10:24:34 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1QAJipa009935 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Feb 2018 10:19:44 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1QAJgRx006097; Mon, 26 Feb 2018 10:19:43 GMT Received: from [192.168.1.4] (/87.18.224.114) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Feb 2018 02:19:42 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 84533 ("[7/8 Regression] ICE with duplicate enum value") Message-ID: <224352b4-659b-ee37-fc6b-bfbecda3d7b4@oracle.com> Date: Mon, 26 Feb 2018 11:19:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8815 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802260142 X-IsSubscribed: yes Hi, this ICE on invalid happens only in c++17 mode, when redeclaration_error_message performs an additional check which only makes sense for data members. Thus the fix is easy: avoid checking DECL_DECLARED_CONSTEXPR_P on CONST_DECLs. Tested x86_64-linux. Thanks, Paolo. ////////////////////// /cp 2018-02-26 Paolo Carlini PR c++/84533 * decl.c (redeclaration_error_message): Don't try to use DECL_DECLARED_CONSTEXPR_P on CONST_DECLs. /testsuite 2018-02-26 Paolo Carlini PR c++/84533 * g++.dg/cpp1z/pr84533.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 257983) +++ cp/decl.c (working copy) @@ -2919,6 +2919,7 @@ redeclaration_error_message (tree newdecl, tree ol specifier is declaration rather than definition (and deprecated). */ if (cxx_dialect >= cxx17 + && VAR_P (olddecl) && DECL_CLASS_SCOPE_P (olddecl) && DECL_DECLARED_CONSTEXPR_P (olddecl) && !DECL_INITIAL (newdecl)) Index: testsuite/g++.dg/cpp1z/pr84533.C =================================================================== --- testsuite/g++.dg/cpp1z/pr84533.C (nonexistent) +++ testsuite/g++.dg/cpp1z/pr84533.C (working copy) @@ -0,0 +1,3 @@ +// { dg-options "-std=c++17" } + +enum E { e, e }; // { dg-error "redefinition" }