Commit c6c06f31 by Ville Voutilainen Committed by Jason Merrill

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
parent f16e2237
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> 2010-11-12 James Dennett <jdennett@google.com>
PR/39415 PR/39415
......
...@@ -1628,12 +1628,6 @@ defaultable_fn_check (tree fn) ...@@ -1628,12 +1628,6 @@ defaultable_fn_check (tree fn)
} }
if (TYPE_BEING_DEFINED (DECL_CONTEXT (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))) if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)))
error ("function %q+D defaulted on its first declaration " error ("function %q+D defaulted on its first declaration "
"must not have an exception-specification", fn); "must not have an exception-specification", fn);
......
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> 2010-11-12 James Dennett <jdennett@google.com>
PR c++/39415 PR c++/39415
......
// PR c++/38796 // PR c++/38796
// { dg-options -std=c++0x } // { dg-options -std=c++0x }
#define SA(X) static_assert ((X), #X)
struct A struct A
{ {
A (int); A (int);
...@@ -11,26 +13,34 @@ struct A ...@@ -11,26 +13,34 @@ struct A
struct B struct B
{ {
private: private:
B() = default; // { dg-error "access" } B() = default;
}; };
SA(__has_trivial_constructor(B));
struct C struct C
{ {
protected: protected:
~C() = default; // { dg-error "access" } ~C() = default;
}; };
SA(__has_trivial_destructor(C));
struct D struct D
{ {
private: private:
D& operator= (const D&) = default; // { dg-error "access" } D& operator= (const D&) = default;
}; };
SA(__has_trivial_assign(D));
struct E struct E
{ {
explicit E (const E&) = default; // { dg-error "explicit" } explicit E (const E&) = default;
}; };
SA(__has_trivial_copy(E));
struct F struct F
{ {
F(F&) = default; // { dg-error "non-const" } F(F&) = default; // { dg-error "non-const" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment