OSDN Git Service

PR c++/46497
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Nov 2010 01:43:10 +0000 (01:43 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Nov 2010 01:43:10 +0000 (01:43 +0000)
* call.c (build_over_call): Check for =delete even when trivial.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166851 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e32c3b7..d651ba8 100644 (file)
@@ -1,5 +1,8 @@
 2010-11-16  Jason Merrill  <jason@redhat.com>
 
+       PR c++/46497
+       * call.c (build_over_call): Check for =delete even when trivial.
+
        DR 1004
        * decl.c (make_unbound_class_template): Handle using
        injected-type-name as template.
index eb7247d..7fa1cf6 100644 (file)
@@ -6057,7 +6057,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
        }
       /* [class.copy]: the copy constructor is implicitly defined even if
         the implementation elided its use.  */
-      else if (!trivial)
+      else if (!trivial || DECL_DELETED_FN (fn))
        {
          mark_used (fn);
          already_used = true;
@@ -6086,7 +6086,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
        }
     }
   else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR
-          && trivial_fn_p (fn))
+          && trivial_fn_p (fn)
+          && !DECL_DELETED_FN (fn))
     {
       tree to = stabilize_reference
        (cp_build_indirect_ref (argarray[0], RO_NULL, complain));
index e40c1e9..76540df 100644 (file)
@@ -1,5 +1,7 @@
 2010-11-16  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/cpp0x/defaulted20.C: New.
+
        * g++.dg/template/injected2.C: New.
 
 2010-11-17  Nicola Pero  <nicola.pero@meta-innovation.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted20.C b/gcc/testsuite/g++.dg/cpp0x/defaulted20.C
new file mode 100644 (file)
index 0000000..d9ad04f
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/46497
+// { dg-options -std=c++0x }
+
+struct A {
+  A(A&&) = default;            // { dg-message "A::A" }
+};
+struct B {
+  const A a;
+  B(const B&) = default;
+  B(B&&) = default;            // { dg-error "implicitly deleted|no match" }
+};
+
+void g(B);                     // { dg-error "argument 1" }
+B&& f();
+
+int main()
+{
+  g(f());                      // { dg-error "deleted" }
+}