From patchwork Wed Nov 10 10:10:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 70618 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 9E2A0B70F6 for ; Wed, 10 Nov 2010 21:10:30 +1100 (EST) Received: (qmail 6683 invoked by alias); 10 Nov 2010 10:10:21 -0000 Received: (qmail 6658 invoked by uid 22791); 10 Nov 2010 10:10:19 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Nov 2010 10:10:13 +0000 Received: by wyb34 with SMTP id 34so507131wyb.20 for ; Wed, 10 Nov 2010 02:10:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.7.194 with SMTP id 44mr8098570wep.7.1289383810452; Wed, 10 Nov 2010 02:10:10 -0800 (PST) Received: by 10.216.245.6 with HTTP; Wed, 10 Nov 2010 02:10:10 -0800 (PST) In-Reply-To: <4CD92100.9050303@oracle.com> References: <4CD49DCD.5070709@oracle.com> <4CD92100.9050303@oracle.com> Date: Wed, 10 Nov 2010 10:10:10 +0000 Message-ID: Subject: Re: [v3] Add constexpr specifiers to std::shared_ptr, std::unique_ptr, etc From: Jonathan Wakely To: Paolo Carlini Cc: "libstdc++" , gcc-patches 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 On 9 November 2010 10:22, Paolo Carlini wrote: > > PS: Jason fixed 46382! Hoorah! that means we can remove these xfails. Tested x86_64-linux. I've also checked in the ChangeLog entry for r166460 which I sent to the lists but didn't commit. 2010-11-10 Jonathan Wakely * include/bits/unique_ptr.h: Use static_assert in constexpr constructors. * testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc: Remove xfails. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-error line number. Index: include/bits/unique_ptr.h =================================================================== --- include/bits/unique_ptr.h (revision 166515) +++ include/bits/unique_ptr.h (working copy) @@ -109,7 +109,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Constructors. constexpr unique_ptr() : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } explicit unique_ptr(pointer __p) @@ -130,7 +131,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) constexpr unique_ptr(nullptr_t) : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } // Move constructors. unique_ptr(unique_ptr&& __u) @@ -269,7 +271,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Constructors. constexpr unique_ptr() : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } explicit unique_ptr(pointer __p) @@ -288,10 +291,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { static_assert(!std::is_reference::value, "rvalue deleter bound to reference"); } - /* TODO: use delegating constructor */ constexpr unique_ptr(nullptr_t) : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } // Move constructors. unique_ptr(unique_ptr&& __u) Index: testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc =================================================================== --- testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc (revision 166515) +++ testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc (working copy) @@ -30,9 +30,9 @@ using std::unique_ptr; void test01() { - unique_ptr p1; // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p1; // { dg-error "here" } - unique_ptr p2(nullptr); // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p2(nullptr); // { dg-error "here" } unique_ptr p3(new int); // { dg-error "here" } } @@ -40,9 +40,9 @@ test01() void test02() { - unique_ptr p1; // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p1; // { dg-error "here" } - unique_ptr p2(nullptr); // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p2(nullptr); // { dg-error "here" } unique_ptr p3(new int[1]); // { dg-error "here" } } Index: testsuite/20_util/weak_ptr/comparison/cmp_neg.cc =================================================================== --- testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (revision 166515) +++ testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (working copy) @@ -43,7 +43,7 @@ main() // { dg-warning "note" "" { target *-*-* } 350 } // { dg-warning "note" "" { target *-*-* } 1082 } -// { dg-warning "note" "" { target *-*-* } 462 } +// { dg-warning "note" "" { target *-*-* } 465 } // { dg-warning "note" "" { target *-*-* } 580 } // { dg-warning "note" "" { target *-*-* } 1027 } // { dg-warning "note" "" { target *-*-* } 340 }