From c6c06f31ca99f23e0dbd0ad8b352c8c6b0bbf01d Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Fri, 12 Nov 2010 17:44:18 -0500 Subject: [PATCH] Core 1135, 1136, 1145, 1149 Core 1135, 1136, 1145, 1149 * method.c (defaultable_fn_check): Do not disallow defaulting a non-public or explicit special member function on its first declaration. From-SVN: r166685 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/method.c | 6 ------ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/defaulted15.C | 18 ++++++++++++++---- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ef36576ff95..aace801e8b8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2010-11-13 Ville Voutilainen + + Core 1135, 1136, 1145, 1149 + * method.c (defaultable_fn_check): Do not disallow defaulting a + non-public or explicit special member function on its first + declaration. + 2010-11-12 James Dennett PR/39415 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 27346d08a23..ed75a64a03f 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1628,12 +1628,6 @@ defaultable_fn_check (tree fn) } 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f372b15548e..7015c2a8833 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-11-13 Ville Voutilainen + + * g++.dg/cpp0x/defaulted15.C: Adjust. + 2010-11-12 James Dennett PR c++/39415 diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted15.C b/gcc/testsuite/g++.dg/cpp0x/defaulted15.C index b54cedb0bcc..4c5b11c9e19 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted15.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted15.C @@ -1,6 +1,8 @@ // PR c++/38796 // { dg-options -std=c++0x } +#define SA(X) static_assert ((X), #X) + struct A { A (int); @@ -11,26 +13,34 @@ struct A struct B { private: - B() = default; // { dg-error "access" } + B() = default; }; +SA(__has_trivial_constructor(B)); + struct C { protected: - ~C() = default; // { dg-error "access" } + ~C() = default; }; +SA(__has_trivial_destructor(C)); + struct D { private: - D& operator= (const D&) = default; // { dg-error "access" } + D& operator= (const D&) = default; }; +SA(__has_trivial_assign(D)); + struct E { - explicit E (const E&) = default; // { dg-error "explicit" } + explicit E (const E&) = default; }; +SA(__has_trivial_copy(E)); + struct F { F(F&) = default; // { dg-error "non-const" } -- 2.30.2