From patchwork Wed Nov 27 10:22:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 294551 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 610B12C007B for ; Wed, 27 Nov 2013 21:23:20 +1100 (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:subject:references :in-reply-to:content-type; q=dns; s=default; b=gRHoTEAfSrUF3yPDS GXlYbvEMWvAMFM7yzmZnBcYfCIlKb9IcLbthiZEthRZuAcA+qKONYhBd5Eb4roL8 9F1RUXf1ditnVZPJOwRIPFQvtaHo5fv2N+SQ9LZDwMHjxx4FaiMiQcWJH+CSLmIp +eqL+Z9xjCudG6SFmLU+V4FdDU= 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:references :in-reply-to:content-type; s=default; bh=VfVh/EnxVCyebWyyPR29Bsy 2gNk=; b=nnzvJm1qNC9+85LyFYhDG8YzBflycjSuVMa69Ck9V73fP83RpxM1wgn rOpk+3Di+f6UBDtqQlGPXVudOa4dtmI00WVArza/ZxmK4pXQYjckRioO1boLAS+W v9MWJJtuGHfQj8B3P1ZR8Fmr4IbPNysuAgcNCtAqUd21PX66x17g= Received: (qmail 23568 invoked by alias); 27 Nov 2013 10:23:10 -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 23553 invoked by uid 89); 27 Nov 2013 10:23:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, SPF_PASS autolearn=no version=3.3.2 X-HELO: aserp1040.oracle.com Received: from Unknown (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 27 Nov 2013 10:23:09 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rARAN05K020886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Nov 2013 10:23:01 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rARAMxwW028916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Nov 2013 10:23:00 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rARAMxvE028908; Wed, 27 Nov 2013 10:22:59 GMT Received: from [192.168.1.4] (/79.45.212.216) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 27 Nov 2013 02:22:59 -0800 Message-ID: <5295C801.703@oracle.com> Date: Wed, 27 Nov 2013 11:22:57 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Jason Merrill , "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 58647 References: <5263FFD2.1040709@oracle.com> <52912DAE.6020304@redhat.com> <52947AB3.5000300@oracle.com> <5294BE80.5080400@redhat.com> <5294CFA5.7060202@oracle.com> <5294F22D.40806@redhat.com> In-Reply-To: <5294F22D.40806@redhat.com> X-IsSubscribed: yes Hi, On 11/26/2013 08:10 PM, Jason Merrill wrote: > On 11/26/2013 11:43 AM, Paolo Carlini wrote: >> We have got a bunch of testcases, for example constexpr-ex4.C - attached >> for your convenience - which trigger the assert !really_overloaded_fn >> (t) ... What do you suggest? > > Aha. Well, in that case we really can't get a constant value, so I'd > assert allow_non_constant, set *non_constant_p, and return t. > > Actually, I'd do that any time we get a function COMPONENT_REF, since > that will only ever happen under the checking maybe_constant_value > call anyway. So a small expansion of your original patch. Thus something like the below? Passes testing. Thanks, Paolo. //////////////////////////// Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 205433) +++ cp/semantics.c (working copy) @@ -9601,6 +9601,12 @@ cxx_eval_constant_expression (const constexpr_call break; case COMPONENT_REF: + if (is_overloaded_fn (t)) + { + gcc_checking_assert (allow_non_constant); + *non_constant_p = true; + return t; + } r = cxx_eval_component_reference (call, t, allow_non_constant, addr, non_constant_p, overflow_p); break; Index: testsuite/g++.dg/parse/crash66.C =================================================================== --- testsuite/g++.dg/parse/crash66.C (revision 0) +++ testsuite/g++.dg/parse/crash66.C (working copy) @@ -0,0 +1,11 @@ +// PR c++/58647 + +struct A +{ + static void foo(); +}; + +template void bar() +{ + A().foo; +}