re PR c++/49066 ([C++0x] Non-defining declaration of deleted function suppresses...
authorJason Merrill <jason@redhat.com>
Sat, 21 May 2011 03:57:12 +0000 (23:57 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 21 May 2011 03:57:12 +0000 (23:57 -0400)
PR c++/49066
* decl.c (duplicate_decls): Preserve DECL_DELETED_FN.

From-SVN: r173993

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/defaulted26.C [new file with mode: 0644]

index 5aff2967a5bdb69a38f3741b9b7d0d2e3cde28a9..0d1968f5a5ebb645d18459ad00d397829e22ee1b 100644 (file)
@@ -1,5 +1,8 @@
 2011-05-20  Jason Merrill  <jason@redhat.com>
 
+       PR c++/49066
+       * decl.c (duplicate_decls): Preserve DECL_DELETED_FN.
+
        PR c++/48873
        * tree.c (stabilize_expr): Fix typo.
 
index 91df9ee671e00d9e047d145f8ae663055e5db0a1..eae7d8ec69b860322d7bb3c5398163d29bd2f3d6 100644 (file)
@@ -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.  */
index c6d5615806b571c82332988b25a937c0e5ee0916..d5fba0b51fd95740abc63bb1aba184603c74d861 100644 (file)
@@ -1,5 +1,7 @@
 2011-05-20  Jason Merrill  <jason@redhat.com>
 
+       * 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 (file)
index 0000000..69bd0ac
--- /dev/null
@@ -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" }