From patchwork Tue Feb 12 20:46:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 219948 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 70B9C2C0090 for ; Wed, 13 Feb 2013 07:47:11 +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=1361306832; 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=xY/R+HT 9TULcuvskvuLnijNLZT4=; b=Vi7zz1aePJXSKPVcmT5qI7pN22ZcnVAYgYHeOKG hE+UQH0aXp1e0yoTQZ9//QUnBDpm6Pm+k3AG6GlObSmD4L9PhJjSPQ2UqaUrh6xk 6PSV0OIFPO2Cl1CC0HVQy86zwPDwb2TQsVxeB/wKqs059epZAOtEp/zTOX1/YL4+ wyTU= 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=VDU2jq53hqFto5cPR7dzS8lku7HQg0RQz/OAHtwIAHYPnZK4G1VtApJ4S6mEaa bGdWz+4+CYcHq3bw5YI9tEY2DfuTavNqS3l5OmwDY2tEdzBWqvgP/EOdFHQPNRuo iN4R3NgbdrAHDMzmTRVpBKwf5EhHncm6CqpB6KmlUkrtQ=; Received: (qmail 27143 invoked by alias); 12 Feb 2013 20:47:06 -0000 Received: (qmail 27133 invoked by uid 22791); 12 Feb 2013 20:47:05 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Tue, 12 Feb 2013 20:46:59 +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 r1CKkwvZ015608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Feb 2013 15:46:58 -0500 Received: from [10.3.113.67] (ovpn-113-67.phx2.redhat.com [10.3.113.67]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1CKkvih029071 for ; Tue, 12 Feb 2013 15:46:57 -0500 Message-ID: <511AAA40.5010103@redhat.com> Date: Tue, 12 Feb 2013 15:46:56 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Thunderbird/21.0a1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/56285 (wrong error with inheriting ctor) 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 We need to move for rvalue ref parms as well as value ones. Tested x86_64-pc-linux-gnu, applying to trunk. commit 29189e48dc7a62ff6a3a67984dbc64f4ada72862 Author: Jason Merrill Date: Tue Feb 12 12:56:52 2013 -0500 PR c++/56285 * method.c (add_one_base_init): Handle base constructor taking rvalue reference parm. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index a1bab95..ff29b59 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -500,7 +500,8 @@ add_one_base_init (tree binfo, tree parm, bool move_p, tree inh, for (; parm; parm = DECL_CHAIN (parm)) { tree exp = convert_from_reference (parm); - if (TREE_CODE (TREE_TYPE (parm)) != REFERENCE_TYPE) + if (TREE_CODE (TREE_TYPE (parm)) != REFERENCE_TYPE + || TYPE_REF_IS_RVALUE (TREE_TYPE (parm))) exp = move (exp); *p = build_tree_list (NULL_TREE, exp); p = &TREE_CHAIN (*p); diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C new file mode 100644 index 0000000..58e848b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor16.C @@ -0,0 +1,15 @@ +// PR c++/56285 +// { dg-options -std=c++11 } + +struct foo { + explicit foo(int&&) {} +}; + +struct bar: private foo { + using foo::foo; +}; + +int main() +{ + bar b { 42 }; +}