From patchwork Tue Nov 18 17:06:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 412110 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 6AFA414011D for ; Wed, 19 Nov 2014 04:06:50 +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=mVAm8asUpvx2sAZgZVsjkHFGJ3H+w+MHNQPFF/LfgtZu+v iZBXfAS4vW20i/tctlFEMoKp4g75QUm0fBEmVPRk3hYx6Ficja8s9EJOBAeG+Ub7 Zv1J7hDfiiwyfjSJf9k/+VIgmF7qAQFHZVaPZwMaEbsXHsQbezb5DKveB/71Q= 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=S10+pDiEY0vN1k76bfOYqbVW6Z4=; b=EvYWQSnJvB6MrRe5kmVQ X8t5+1Rc5m7ZxahaoYeBze80oP/0qdiYzI9bP8Qxh4XMIyRUdGgiC95AcbjvIuka ZlVKDxoBYd+wsEYZarWx6PA8kfAeFJPm4T2wtLCJp3fNaM0pAxzZwtlh8bz7+snN FC2N3vWx6qwqdrxHCF89HB4= Received: (qmail 25605 invoked by alias); 18 Nov 2014 17:06:43 -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 25594 invoked by uid 89); 18 Nov 2014 17:06:42 -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; Tue, 18 Nov 2014 17:06:37 +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 sAIH6ag7021769 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 18 Nov 2014 12:06:36 -0500 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 sAIH6Zoe032432 for ; Tue, 18 Nov 2014 12:06:35 -0500 Message-ID: <546B7C98.4000702@redhat.com> Date: Tue, 18 Nov 2014 12:06:32 -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: C++ PATCH for c++/63934 (constexpr failure on ARM) On ARM constructors return a pointer, so the test for void return breaks. We also don't need to mess with the CONSTRUCTOR we built up in the new scheme. Tested x86_64-pc-linux-gnu, applying to trunk. commit ddfea2b5af06860433d32ad440673c2df37dc8f1 Author: Jason Merrill Date: Tue Nov 18 11:14:22 2014 -0500 PR c++/63934 * constexpr.c (cxx_eval_call_expression): Check DECL_CONSTRUCTOR_P rather than VOID_TYPE_P. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 67d039e..691dd78 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1327,7 +1327,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, addr, non_constant_p, overflow_p, &jump_target); - if (VOID_TYPE_P (TREE_TYPE (res))) + if (DECL_CONSTRUCTOR_P (fun)) /* This can be null for a subobject constructor call, in which case what we care about is the initialization side-effects rather than the value. We could get at the @@ -1366,7 +1366,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, { /* If this was a call to initialize an object, set the type of the CONSTRUCTOR to the type of that object. */ - if (DECL_CONSTRUCTOR_P (fun)) + if (DECL_CONSTRUCTOR_P (fun) && !use_new_call) { tree ob_arg = get_nth_callarg (t, 0); STRIP_NOPS (ob_arg);