From patchwork Mon Jun 6 19:43:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 99017 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]) by ozlabs.org (Postfix) with SMTP id 3DF35B6F88 for ; Tue, 7 Jun 2011 05:43:49 +1000 (EST) Received: (qmail 22784 invoked by alias); 6 Jun 2011 19:43:47 -0000 Received: (qmail 22776 invoked by uid 22791); 6 Jun 2011 19:43:46 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Jun 2011 19:43:28 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p56JhSpI019030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 6 Jun 2011 15:43:28 -0400 Received: from [127.0.0.1] (ovpn-113-53.phx2.redhat.com [10.3.113.53]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p56JhRqN020970 for ; Mon, 6 Jun 2011 15:43:28 -0400 Message-ID: <4DED2DDF.90102@redhat.com> Date: Mon, 06 Jun 2011 15:43:27 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/49298 (C++0x regression with pointer to member) 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 potential_constant_expression_1 didn't know how to deal with a pointer-to-member expression in a template. Tested x86_64-pc-linux-gnu, applied to trunk. commit a07ee89ff40f73dcb1fc11fb66931ee79bf8a2d9 Author: Jason Merrill Date: Mon Jun 6 12:05:39 2011 -0400 PR c++/49298 * semantics.c (potential_constant_expression_1): Handle FIELD_DECL. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5626a86..f005f2f 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7489,6 +7489,8 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) case TEMPLATE_PARM_INDEX: case TRAIT_EXPR: case IDENTIFIER_NODE: + /* We can see a FIELD_DECL in a pointer-to-member expression. */ + case FIELD_DECL: return true; case PARM_DECL: diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C new file mode 100644 index 0000000..873000b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C @@ -0,0 +1,9 @@ +// PR c++/49298 +// { dg-options -std=c++0x } + +template struct B { }; +template struct A +{ + int i; + B b; +};