From: Jason Merrill Date: Fri, 18 Mar 2011 15:07:04 +0000 (-0400) Subject: re PR c++/48118 (g++ sometimes allows copying a volatile class) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6baef836f11dd7273c258a41cbfc44f462e3828;p=gcc.git re PR c++/48118 (g++ sometimes allows copying a volatile class) PR c++/48118 * call.c (build_over_call): Don't skip ck_rvalue. From-SVN: r171147 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 51535f5168b..9578f1abf36 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-03-18 Jason Merrill + + PR c++/48118 + * call.c (build_over_call): Don't skip ck_rvalue. + 2011-03-17 Jason Merrill PR c++/47504 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d040ec85072..93383c69f07 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b9c7dd84400..b0f4f53566d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-03-18 Jason Merrill + * 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 index 00000000000..baf467d8182 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/volatile1.C @@ -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" } +}