From patchwork Wed Nov 26 18:19:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 415228 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 D766A140188 for ; Thu, 27 Nov 2014 05:19:32 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=M+Fq1MKYkudRENShJdYcKrrPRcVJSoGC4S5QRQf2M9ro5i GuEvVi7TIcQBZMVRYGjgUn4wEBURVlpYWpYW1hBZ1Yegmy40x0ZRRhhyYND+V2nD WqtA5tdijsnYPFTnTDoD0cE5Nf1Khgl7Rvm5XmQ1HMD57mIj6fPyYhPxdCPkw= 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=7b7Pgo96A0YS1gVJr42bxbmFp18=; b=aec9kC3PiL/LYlFptMTt UBGvSq9wSIGha95nvKtX5llc1CbhAZQwUk7qmPmigPbB2xJPvZDKhupAsjKML5G8 Ia9ea4ESLVuBUSed2L7QOzVOQd4CWlcQTsYp7GDlaguj+xjo8xJwfQTrNDLeBv3P OBlsnrzlj4dyI7SzqSAWzmk= Received: (qmail 16125 invoked by alias); 26 Nov 2014 18:19:26 -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 16113 invoked by uid 89); 26 Nov 2014 18:19: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, 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, 26 Nov 2014 18:19:24 +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 (8.14.4/8.14.4) with ESMTP id sAQIJN1P006150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 26 Nov 2014 13:19:23 -0500 Received: from [10.10.116.27] ([10.10.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAQIJM6t014014 for ; Wed, 26 Nov 2014 13:19:23 -0500 Message-ID: <547619A9.4090808@redhat.com> Date: Wed, 26 Nov 2014 13:19:21 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: gcc-patches List Subject: Two small constexpr PATCHes 1) It occurred to me that now that there are side-effects in constant-expressions, we need to guard against multiple evaluation of SAVE_EXPR. 2) We don't want to complain about flowing off the end of a function because something in the function was non-constant. Tested x86_64-pc-linux-gnu, applying to trunk. commit e1851b1d2be83cf9ee13a8a21faac3dcac52d746 Author: Jason Merrill Date: Wed Nov 26 12:00:20 2014 -0500 * constexpr.c (cxx_eval_call_expression): Don't talk about flowing off the end if we're already non-constant. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 2678223..111ea5b 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1344,7 +1344,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, else { result = *ctx->values->get (slot ? slot : res); - if (result == NULL_TREE) + if (result == NULL_TREE && !*non_constant_p) { if (!ctx->quiet) error ("constexpr call flows off the end "