From patchwork Fri Nov 12 22:52:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ville Voutilainen X-Patchwork-Id: 71027 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 34974B7134 for ; Sat, 13 Nov 2010 09:53:38 +1100 (EST) Received: (qmail 29025 invoked by alias); 12 Nov 2010 22:53:35 -0000 Received: (qmail 29016 invoked by uid 22791); 12 Nov 2010 22:53:34 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yw0-f47.google.com (HELO mail-yw0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 12 Nov 2010 22:52:52 +0000 Received: by ywo32 with SMTP id 32so863237ywo.20 for ; Fri, 12 Nov 2010 14:52:50 -0800 (PST) Received: by 10.151.6.8 with SMTP id j8mr4774841ybi.202.1289602369322; Fri, 12 Nov 2010 14:52:49 -0800 (PST) Received: from [131.225.95.90] (ville-hp.dhcp.fnal.gov [131.225.95.90]) by mx.google.com with ESMTPS id r25sm2702330yhc.0.2010.11.12.14.52.48 (version=SSLv3 cipher=RC4-MD5); Fri, 12 Nov 2010 14:52:48 -0800 (PST) Subject: C++: Remove restrictions on defaulting non-public or explicit special member functions on their first declaration From: ville To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com Date: Sat, 13 Nov 2010 00:52:40 +0200 Message-ID: <1289602360.6612.1.camel@ville-hp> 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 Implements the new wording drafted for FI-4/5. Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 166633) +++ gcc/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2010-11-13 Ville Voutilainen + + * method.c (defaultable_fn_check): Do not disallow defaulting a + non-public or explicit special member function on its first + declaration. + 2010-11-11 Jan Hubicka * opts.c (finish_options): Do not error on -flto-partition alone. Index: gcc/testsuite/g++.dg/cpp0x/defaulted15.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/defaulted15.C (revision 166633) +++ gcc/testsuite/g++.dg/cpp0x/defaulted15.C (working copy) @@ -11,24 +11,24 @@ struct B { private: - B() = default; // { dg-error "access" } + B() = default; }; struct C { protected: - ~C() = default; // { dg-error "access" } + ~C() = default; }; struct D { private: - D& operator= (const D&) = default; // { dg-error "access" } + D& operator= (const D&) = default; }; struct E { - explicit E (const E&) = default; // { dg-error "explicit" } + explicit E (const E&) = default; }; struct F Index: gcc/cp/method.c =================================================================== --- gcc/cp/method.c (revision 166633) +++ gcc/cp/method.c (working copy) @@ -1628,12 +1628,6 @@ } if (TYPE_BEING_DEFINED (DECL_CONTEXT (fn))) { - if (DECL_NONCONVERTING_P (fn)) - error ("%qD declared explicit cannot be defaulted in the class " - "body", fn); - if (current_access_specifier != access_public_node) - error ("%qD declared with non-public access cannot be defaulted " - "in the class body", fn); if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn))) error ("function %q+D defaulted on its first declaration " "must not have an exception-specification", fn);