From patchwork Tue Jan 3 21:38:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 134094 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 E5898B6FA4 for ; Wed, 4 Jan 2012 08:38:42 +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=1326231523; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=S3uaJCBcUnTj5HQ2fDyY9bybuSM=; b=frpDE/DYr1iWVO3dL/EPUyEX2BnVHWwI1wWxBd+MkYxn+S7+vNsxIUFGS9Ac33 FSEQPv2kL3VPLbRTNmgeTfNwSWkr1k4/BJJGRFrlioveDc4YbUSCwrWOUM4+Tca+ KVPuSHdj7eg95n1Tr0ee+5Sj73/WowEXs3abaOYYBb0GU= 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:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=R4XJb99YjwvFLuhUCiV1sBkWVVd1spN1w/8Bt6hGHx2rkYkVs2eAdd1S9LqsO3 8UWwi25yuYcGtKODJEROUbiL1MsTen8knOwIFmQx8Ws/BQk7Cp1AFBirtMosBKCz SFDoRMOPB3VsvEtmw92N/sswWTmrQIcMS0PEgiG9ncwwU=; Received: (qmail 16933 invoked by alias); 3 Jan 2012 21:38:39 -0000 Received: (qmail 16918 invoked by uid 22791); 3 Jan 2012 21:38:38 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-we0-f175.google.com (HELO mail-we0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Jan 2012 21:38:23 +0000 Received: by werm13 with SMTP id m13so9257491wer.20 for ; Tue, 03 Jan 2012 13:38:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.136.75 with SMTP id v53mr29862781wei.42.1325626701968; Tue, 03 Jan 2012 13:38:21 -0800 (PST) Received: by 10.216.28.194 with HTTP; Tue, 3 Jan 2012 13:38:21 -0800 (PST) In-Reply-To: References: <1325618257-2435-1-git-send-email-chase.douglas@canonical.com> <4F0368D8.5060500@canonical.com> Date: Tue, 3 Jan 2012 21:38:21 +0000 Message-ID: Subject: Re: [PATCH v2] [4.6] shared_ptr needs explicit copy constructor From: Jonathan Wakely To: Chase Douglas Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org, Matthias Klose 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 I get testsuite failures with this change applied: FAIL: 20_util/shared_ptr/cons/43820_neg.cc (test for errors, line 858) FAIL: 20_util/shared_ptr/cons/43820_neg.cc (test for excess errors) FAIL: 20_util/weak_ptr/comparison/cmp_neg.cc (test for warnings, line 354) FAIL: 20_util/weak_ptr/comparison/cmp_neg.cc (test for warnings, line 1085) FAIL: 20_util/weak_ptr/comparison/cmp_neg.cc (test for excess errors) Did you not see them when testing? Here's what I'm checking in 2012-01-03 Chase Douglas Jonathan Wakely * include/bits/shared_ptr.h: Default copy ctor and assignment. * include/bits/shared_ptr_base.h: Likewise. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise. Index: include/bits/shared_ptr.h =================================================================== --- include/bits/shared_ptr.h (revision 182460) +++ include/bits/shared_ptr.h (working copy) @@ -100,6 +100,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr shared_ptr() : __shared_ptr<_Tp>() { } + shared_ptr(const shared_ptr&) = default; // never throws + /** * @brief Construct a %shared_ptr that owns the pointer @a __p. * @param __p A pointer that is convertible to element_type*. @@ -264,6 +266,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr shared_ptr(nullptr_t __p) : __shared_ptr<_Tp>(__p) { } + shared_ptr& operator=(const shared_ptr&) = default; + template shared_ptr& operator=(const shared_ptr<_Tp1>& __r) // never throws Index: include/bits/shared_ptr_base.h =================================================================== --- include/bits/shared_ptr_base.h (revision 182460) +++ include/bits/shared_ptr_base.h (working copy) @@ -799,7 +799,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws { } - // generated copy constructor, assignment, destructor are fine. + __shared_ptr(const __shared_ptr&) = default; // never throws + __shared_ptr& operator=(const __shared_ptr&) = default; // never throws template::value>::type> Index: testsuite/20_util/shared_ptr/cons/43820_neg.cc =================================================================== --- testsuite/20_util/shared_ptr/cons/43820_neg.cc (revision 182460) +++ testsuite/20_util/shared_ptr/cons/43820_neg.cc (working copy) @@ -35,6 +35,6 @@ void test01() // { dg-error "incomplete" "" { target *-*-* } 766 } std::shared_ptr p9(ap()); // { dg-error "here" } - // { dg-error "incomplete" "" { target *-*-* } 858 } + // { dg-error "incomplete" "" { target *-*-* } 859 } } Index: testsuite/20_util/weak_ptr/comparison/cmp_neg.cc =================================================================== --- testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (revision 182460) +++ testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (working copy) @@ -42,8 +42,8 @@ main() return 0; } -// { dg-warning "note" "" { target *-*-* } 354 } -// { dg-warning "note" "" { target *-*-* } 1085 } +// { dg-warning "note" "" { target *-*-* } 358 } +// { dg-warning "note" "" { target *-*-* } 1086 } // { dg-warning "note" "" { target *-*-* } 468 } // { dg-warning "note" "" { target *-*-* } 586 } // { dg-warning "note" "" { target *-*-* } 1049 }