diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-09 18:44:02 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-09 18:44:02 +0000 |
commit | ad2320c4eccc00870a485d873432bd7cbddbfa37 (patch) | |
tree | 074374cde384b02640d55bbe9f668f276e000148 | |
parent | c4cc9e8cca19e454964bac352bcc4c33f58ce865 (diff) | |
download | gcc-ad2320c4eccc00870a485d873432bd7cbddbfa37.tar.gz |
cp:
PR c++/14397
* call.c (convert_like_real): Build a const qualified temporary,
when testing ctor access.
testsuite:
PR c++/14397
* g++.dg/overload/ref1.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79196 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/overload/ref1.C | 21 |
4 files changed, 36 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eefa1e76dbc..a0d2b067492 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-03-09 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/14397 + * call.c (convert_like_real): Build a const qualified temporary, + when testing ctor access. + 2004-03-09 Mark Mitchell <mark@codesourcery.com> * call.c (initialize_reference): Fix typo. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b43efcdae3f..320159ba9e7 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4209,9 +4209,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, if (convs->check_copy_constructor_p) /* Generate a temporary copy purely to generate the required diagnostics. */ - build_temp (build_dummy_object (totype), totype, - LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING, - &diagnostic_fn); + build_temp + (build_dummy_object + (build_qualified_type (totype, TYPE_QUAL_CONST)), + totype, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING, &diagnostic_fn); return expr; case ck_ambig: /* Call build_user_type_conversion again for the error. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf41ef5900f..6f61dd7e5e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-03-09 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/14397 + * g++.dg/overload/ref1.C: New. + 2004-03-09 Giovanni Bajo <giovannibajo@gcc.gnu.org> PR c++/14409 diff --git a/gcc/testsuite/g++.dg/overload/ref1.C b/gcc/testsuite/g++.dg/overload/ref1.C new file mode 100644 index 00000000000..e239d88a438 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/ref1.C @@ -0,0 +1,21 @@ +// Copyright (C) 2004 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 Mar 2004 <nathan@codesourcery.com> + +// Origin: schmid@snake.iap.physik.tu-darmstadt.de +// Bug 14397: Bogus access error. + +struct S { + S (int); + S(S const&); + private: + S(S&); +}; + +S foo() +{ + int result = 0; + + S s ((0,S (result))); + + return S (result); +} |