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
This commit is contained in:
Ville Voutilainen 2010-11-12 17:44:18 -05:00 committed by Jason Merrill
parent f16e223735
commit c6c06f31ca
4 changed files with 25 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2010-11-13 Ville Voutilainen <ville.voutilainen@gmail.com> <ville.voutilainen@symbio.com>
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 <jdennett@google.com>
PR/39415

View File

@ -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);

View File

@ -1,3 +1,7 @@
2010-11-13 Ville Voutilainen <ville.voutilainen@gmail.com> <ville.voutilainen@symbio.com>
* g++.dg/cpp0x/defaulted15.C: Adjust.
2010-11-12 James Dennett <jdennett@google.com>
PR c++/39415

View File

@ -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" }