From patchwork Tue Nov 26 10:40:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 294292 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 697312C00AD for ; Tue, 26 Nov 2013 21:42:38 +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=CVQm8V4V5Dc4R0qp1 xDVZWZZ6k6JrnlXPF0y3kydZSLhdCCg2xuud6mEIR3FwzBj8UpEtu/KWExDXYZQY KNtsYBiT0IX+4IrFEFiBqF3KYGWYAkBI+AqKPMugkVYWs0EsGr9v7l587rk7Tlwy WyLHLb6l9H+6nSAi5+jCc7Uy3A= 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=LGmieNXcPQezYKqeU+fZ156 lPrw=; b=bzjGQwimR7Cvv95jA/fRwlEbYaT3MOiy0LxqLFZG+RfjVpXsygQ3n0J p0SRyNofTgpjaNtKpAcz+B+mDswiVvWjkxDbfGUO8fKX0mSf3ADHIL/pJxWjqaJs KRQVgIuyUTYo5AhDnqf2RZuY8poRjkH8tCs7NTVYdG9XoZxuAYe8= Received: (qmail 580 invoked by alias); 26 Nov 2013 10:42:27 -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 569 invoked by uid 89); 26 Nov 2013 10:42:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_20, RDNS_NONE, SPF_PASS autolearn=no version=3.3.2 X-HELO: userp1040.oracle.com Received: from Unknown (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 26 Nov 2013 10:41:02 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rAQAesBR010464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Nov 2013 10:40:54 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAQAerTc009742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 26 Nov 2013 10:40:54 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAQAerrN009731; Tue, 26 Nov 2013 10:40:53 GMT Received: from [192.168.1.4] (/79.52.195.218) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 Nov 2013 02:40:53 -0800 Message-ID: <52947AB3.5000300@oracle.com> Date: Tue, 26 Nov 2013 11:40:51 +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> In-Reply-To: <52912DAE.6020304@redhat.com> X-IsSubscribed: yes Hi, On 11/23/2013 11:35 PM, Jason Merrill wrote: > On 10/20/2013 12:07 PM, Paolo Carlini wrote: >> case COMPONENT_REF: >> + if (is_overloaded_fn (TREE_OPERAND (t, 1))) >> + return t; > > Hmm, I'd be inclined to strip the COMPONENT_REF in this case to > produce something that's actually usable as a constant. Does that work? I see. Thus I tested successfully the below (which, for the testcase, forwards a BASELINK) or you mean something more complex? Thanks, Paolo. ////////////////// Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 205382) +++ cp/semantics.c (working copy) @@ -9601,8 +9601,13 @@ cxx_eval_constant_expression (const constexpr_call break; case COMPONENT_REF: - r = cxx_eval_component_reference (call, t, allow_non_constant, addr, - non_constant_p, overflow_p); + if (is_overloaded_fn (TREE_OPERAND (t, 1))) + r = cxx_eval_constant_expression (call, TREE_OPERAND (t, 1), + allow_non_constant, addr, + non_constant_p, overflow_p); + else + r = cxx_eval_component_reference (call, t, allow_non_constant, addr, + non_constant_p, overflow_p); break; case BIT_FIELD_REF: 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; +}