re PR c++/48118 (g++ sometimes allows copying a volatile class)
authorJason Merrill <jason@redhat.com>
Fri, 18 Mar 2011 15:07:04 +0000 (11:07 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 18 Mar 2011 15:07:04 +0000 (11:07 -0400)
PR c++/48118
* call.c (build_over_call): Don't skip ck_rvalue.

From-SVN: r171147

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

index 51535f5168bc91f862210f316b66d2f609d027f5..9578f1abf3660d7a472b0cd0519873d627c64563 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-18  Jason Merrill  <jason@redhat.com>
+
+       PR c++/48118
+       * call.c (build_over_call): Don't skip ck_rvalue.
+
 2011-03-17  Jason Merrill  <jason@redhat.com>
 
        PR c++/47504
index d040ec850728e422ecc2895e76ada867d78898ad..93383c69f07cc6cc0b9f5a6657755466eec3ed97 100644 (file)
@@ -6168,12 +6168,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
 
       conv = convs[i];
 
-      /* Don't make a copy here if build_call is going to.  */
-      if (conv->kind == ck_rvalue
-         && COMPLETE_TYPE_P (complete_type (type))
-         && !TREE_ADDRESSABLE (type))
-       conv = conv->u.next;
-
       /* Warn about initializer_list deduction that isn't currently in the
         working draft.  */
       if (cxx_dialect > cxx98
index b9c7dd844000bebfc65712194daebee4dd5540e8..b0f4f53566d793ed437c4068dda06f81517a7eae 100644 (file)
@@ -1,5 +1,7 @@
 2011-03-18  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/overload/volatile1.C: New.
+
        * g++.dg/opt/pr23372.C: New.
 
        * g++.dg/ext/attrib32.C: Expect errors on the two-names case.
diff --git a/gcc/testsuite/g++.dg/overload/volatile1.C b/gcc/testsuite/g++.dg/overload/volatile1.C
new file mode 100644 (file)
index 0000000..baf467d
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/48118
+// { dg-prune-output "note" }
+
+struct A { };
+
+void f (A);                    // { dg-error "argument 1" }
+void (*g)(A);
+
+int main()
+{
+  volatile A a;
+  f(a);                                // { dg-error "no match" }
+  g(a);                                // { dg-error "no match" }
+}