From: Jason Merrill Date: Sat, 21 May 2011 03:57:12 +0000 (-0400) Subject: re PR c++/49066 ([C++0x] Non-defining declaration of deleted function suppresses... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c54a6b835913f97446cb0dfeb3c257009b61230e;p=gcc.git re PR c++/49066 ([C++0x] Non-defining declaration of deleted function suppresses usage validation) PR c++/49066 * decl.c (duplicate_decls): Preserve DECL_DELETED_FN. From-SVN: r173993 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5aff2967a5b..0d1968f5a5e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-20 Jason Merrill + PR c++/49066 + * decl.c (duplicate_decls): Preserve DECL_DELETED_FN. + PR c++/48873 * tree.c (stabilize_expr): Fix typo. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 91df9ee671e..eae7d8ec69b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1688,6 +1688,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) error ("deleted definition of %qD", newdecl); error ("after previous declaration %q+D", olddecl); } + DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl); } /* Deal with C++: must preserve virtual function table size. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6d5615806b..d5fba0b51fd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-20 Jason Merrill + * g++.dg/cpp0x/defaulted26.C: New. + * g++.dg/cpp0x/noexcept02.C: Fix. * g++.dg/cpp0x/noexcept03.C: Fix. * g++.dg/cpp0x/noexcept08.C: Fix. diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted26.C b/gcc/testsuite/g++.dg/cpp0x/defaulted26.C new file mode 100644 index 00000000000..69bd0accbd4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted26.C @@ -0,0 +1,7 @@ +// PR c++/49066 +// { dg-options -std=c++0x } + +void foo() = delete; // { dg-error "declared here" } +void foo(); + +int main() { foo(); } // { dg-error "deleted" }