From e6baef836f11dd7273c258a41cbfc44f462e3828 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 18 Mar 2011 11:07:04 -0400 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/call.c | 6 ------ gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/overload/volatile1.C | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/overload/volatile1.C 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" } +} -- 2.30.2