From patchwork Mon Nov 19 13:53:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 200006 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 8C1992C00C4 for ; Tue, 20 Nov 2012 00:54:01 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353938042; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=sshI/b4 uaGf0/oQoAmfr2jR96/Y=; b=HnrHQueK6qrKa6g52YWKVAjhW+j3jEtablfjNe9 N3P9tLVTSwhu+haBOnGk/Agj8/WDXli0JOVyDON7ZhNTyKjZ/SfNqz1rcoTJ57X2 YizfpUTqi9Y76IsufHr4kFDRItnYyy/X7cYP0oIkwpnNdV9p+PcAVtr32ofHtJQT UVYI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=E4TbUSW89ZngjN4yc7dZzeQ+2dRoels/IlYux97GjbWj+c5yI0LJothFl0mL3S AsRFaOwP25YyJh8wNDk1/XEP8qo85ALcj57CQg0gg8qBp9jmHG6Xwvd6iepGwJvS tSSzgKM4Gf0IpAYjJA+BixGX1ycneQI3i/Vrg+/+DZjg8=; Received: (qmail 7420 invoked by alias); 19 Nov 2012 13:53:46 -0000 Received: (qmail 7327 invoked by uid 22791); 19 Nov 2012 13:53:45 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_FN 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, 19 Nov 2012 13:53:34 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAJDrWKR020226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 19 Nov 2012 08:53:32 -0500 Received: from [10.3.113.62] (ovpn-113-62.phx2.redhat.com [10.3.113.62]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAJDrW5i029819 for ; Mon, 19 Nov 2012 08:53:32 -0500 Message-ID: <50AA39DB.3030800@redhat.com> Date: Mon, 19 Nov 2012 08:53:31 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121029 Thunderbird/16.0.2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCHes for inheriting ctor issues 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 When I implemented inheriting constructors, I thought that the wording that said that base copy/move constructors are not inherited was a wording problem, but discussion on the reflector indicates that it was intended, so that wrapper classes act like strong typedefs rather than drop-in replacements. So the first patch implements that. In 55261 we were using CLASSTYPE_CONSTRUCTORS while the type still had undeclared lazy constructors, so we need to use lookup_fnfields to get the lazy declarations. For 55262 we need to set DECL_PARM_INDEX on the inherited parameters. Tested x86_64-pc-linux-gnu, applying to trunk. commit bdfd9834c861aaead76fa86ace1b9c70409443d0 Author: Jason Merrill Date: Thu Nov 15 11:58:50 2012 -0500 PR c++/55262 * method.c (implicitly_declare_fn): Set DECL_PARM_INDEX on the parms of an inheriting ctor. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 6458032..6dcb63a 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1663,10 +1663,14 @@ implicitly_declare_fn (special_function_kind kind, tree type, else if (kind == sfk_inheriting_constructor) { tree *p = &DECL_ARGUMENTS (fn); + int index = 1; for (tree parm = inherited_parms; parm != void_list_node; parm = TREE_CHAIN (parm)) { *p = cp_build_parm_decl (NULL_TREE, TREE_VALUE (parm)); + retrofit_lang_decl (*p); + DECL_PARM_LEVEL (*p) = 1; + DECL_PARM_INDEX (*p) = index++; DECL_CONTEXT (*p) = fn; p = &DECL_CHAIN (*p); } diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C index de57453..56c5bd6 100644 --- a/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor10.C @@ -1,4 +1,4 @@ -// { dg-options "-std=c++11" } +// { dg-options "-std=c++11 -g" } struct A {