From patchwork Fri May 6 11:08:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 94361 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 560B510080E for ; Fri, 6 May 2011 21:08:52 +1000 (EST) Received: (qmail 27764 invoked by alias); 6 May 2011 11:08:50 -0000 Received: (qmail 27753 invoked by uid 22791); 6 May 2011 11:08:49 -0000 X-SWARE-Spam-Status: No, hits=-5.8 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; Fri, 06 May 2011 11:08:29 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p46B8S1m030770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 May 2011 07:08:28 -0400 Received: from localhost (ovpn-113-104.phx2.redhat.com [10.3.113.104]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p46B8QBS015507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 6 May 2011 07:08:28 -0400 Received: by localhost (Postfix, from userid 500) id 9CF37DB55; Fri, 6 May 2011 13:08:25 +0200 (CEST) From: Dodji Seketeli To: Jason Merrill Cc: GCC Patches Subject: Re: [PATCH] Fix PR c++/48574 References: <4DC333FF.8030106@redhat.com> X-URL: http://www.redhat.com Date: Fri, 06 May 2011 13:08:25 +0200 In-Reply-To: <4DC333FF.8030106@redhat.com> (Jason Merrill's message of "Thu, 05 May 2011 19:34:23 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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 Jason Merrill writes: > How about type_dependent_expression_p_push instead? Like this ? Lightly tested. A full bootstrap and regression test is under way. Thanks. gcc/cp/ PR c++/48574 * class.c (fixed_type_or_null): Use type_dependent_p_push to test if the instance has a dependent initializer. gcc/testsuite/ PR c++/48574 * g++.dg/template/dependent-expr8.C: New test case. --- gcc/cp/class.c | 2 +- gcc/testsuite/g++.dg/template/dependent-expr8.C | 25 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/dependent-expr8.C diff --git a/gcc/cp/class.c b/gcc/cp/class.c index a67b34a..6b08a03 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5939,7 +5939,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp) itself. */ if (TREE_CODE (instance) == VAR_DECL && DECL_INITIAL (instance) - && !type_dependent_expression_p (DECL_INITIAL (instance)) + && !type_dependent_expression_p_push (DECL_INITIAL (instance)) && !htab_find (ht, instance)) { tree type; diff --git a/gcc/testsuite/g++.dg/template/dependent-expr8.C b/gcc/testsuite/g++.dg/template/dependent-expr8.C new file mode 100644 index 0000000..20014d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-expr8.C @@ -0,0 +1,25 @@ +// Origin PR c++/48574 +// { dg-options "-std=c++0x" } +// { dg-do compile } + +struct A +{ + virtual int foo(); +}; + +void baz (int); + +template +void +bar(T x) +{ + A &b = *x; + baz (b.foo ()); +} + +void +foo() +{ + A a; + bar(&a); +}