From patchwork Fri Apr 24 14:50:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 464220 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 628B2140150 for ; Sat, 25 Apr 2015 00:50:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=HvaYjICf; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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:subject:content-type; q= dns; s=default; b=fxkZ0Dl1g9syom3rkcDXmZTXmqpV2bX+UlaMbOpBNBgpAj 7cSUFrL9PY9keAZV5S8fz38DQ7xg8b4Zml3v9a14QJ6+TSef1OYXeccJSS02UrXq ihRhcTWMBMlovgR09AsZK5IgGsRKtcyjnxoJaXE/Wn0uAcfudY9rKqHAXgzqw= 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:subject:content-type; s= default; bh=IiPPkuAu9OtHaSVgGMdTSLEyiMY=; b=HvaYjICft5ux9of6zAQH 6JXE9/+zVDgsALY9Ch10rkEbNShyMg9HzYFYsI/jYO1qwE5DlaQ3fQvFbJXZMDqD /VDrO24gs1OjsyiUu+6gSoNX8Z0x6oa5u8P8jEPwawQdJyA9CpJUgQn3mn8tKNwZ wWz4l5XglJTAwXijptD+lvU= Received: (qmail 43177 invoked by alias); 24 Apr 2015 14:50:28 -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 43164 invoked by uid 89); 24 Apr 2015 14:50:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no 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; Fri, 24 Apr 2015 14:50:27 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A8598B5E9E for ; Fri, 24 Apr 2015 14:50:26 +0000 (UTC) Received: from [10.10.116.43] ([10.10.116.43]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3OEoNcF018578 for ; Fri, 24 Apr 2015 10:50:26 -0400 Message-ID: <553A582B.5070405@redhat.com> Date: Fri, 24 Apr 2015 10:50:19 -0400 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 to remove obsolete cases from potential_constant_expression_1 potential_constant_expression_1 originally implemented an early version of the constexpr proposal, which included a concept of "potential constant expression" that no longer exists in the standard. It's still useful for catching expressions that could never be constant, but these two are obsolete. Tested x86_64-pc-linux-gnu, applying to trunk. commit f7ac4fd6b541a7b07fc041e1300c7169672dc97e Author: Jason Merrill Date: Thu Apr 23 17:19:49 2015 -0400 * constexpr.c (potential_constant_expression_1) [MINUS_EXPR]: Remove obsolete code. [NE_EXPR]: Likewise. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 2990519..6465677 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -4156,15 +4156,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, } case MINUS_EXPR: - /* -- a subtraction where both operands are pointers. */ - if (TYPE_PTR_P (TREE_OPERAND (t, 0)) - && TYPE_PTR_P (TREE_OPERAND (t, 1))) - { - if (flags & tf_error) - error ("difference of two pointer expressions is not " - "a constant expression"); - return false; - } want_rval = true; goto binary; @@ -4174,16 +4165,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, case GE_EXPR: case EQ_EXPR: case NE_EXPR: - /* -- a relational or equality operator where at least - one of the operands is a pointer. */ - if (TYPE_PTR_P (TREE_OPERAND (t, 0)) - || TYPE_PTR_P (TREE_OPERAND (t, 1))) - { - if (flags & tf_error) - error ("pointer comparison expression is not a " - "constant expression"); - return false; - } want_rval = true; goto binary;