From: Nathan Sidwell Date: Mon, 24 Mar 2003 19:47:17 +0000 (+0000) Subject: PR c++/9898, PR c++/383, DR 322 X-Git-Tag: releases/gcc-3.4.0~7682 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c82cc908167526cae555db74532db40f889fe1d;p=thirdparty%2Fgcc.git PR c++/9898, PR c++/383, DR 322 cp: PR c++/9898, PR c++/383, DR 322 * pt.c (maybe_adjust_types_for_deduction) [DEDUCE_CONV]: Look through reference types on both PARM and ARG. testsuite: PR c++/9898, c++/383 * g++.dg/template/conv6.C: New test. From-SVN: r64815 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8cc29882ab90..b2d4f795a78d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-03-24 Nathan Sidwell + + PR c++/9898, PR c++/383, DR 322 + * pt.c (maybe_adjust_types_for_deduction) [DEDUCE_CONV]: Look + through reference types on both PARM and ARG. + 2003-03-24 Nathan Sidwell PR c++/10119 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index aa9a2c728025..3557f9fec718 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8753,6 +8753,12 @@ maybe_adjust_types_for_deduction (strict, parm, arg) *parm = TREE_TYPE (*parm); result |= UNIFY_ALLOW_OUTER_MORE_CV_QUAL; } + + /* DR 322. For conversion deduction, remove a reference type on parm + too (which has been swapped into ARG). */ + if (strict == DEDUCE_CONV && TREE_CODE (*arg) == REFERENCE_TYPE) + *arg = TREE_TYPE (*arg); + return result; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a5f853a4e280..cb6e0971f261 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2003-03-24 Nathan Sidwell + PR c++/9898, c++/383 + * g++.dg/template/conv6.C: New test. + PR c++/10119 * g++.dg/template/ptrmem5.C: New test. diff --git a/gcc/testsuite/g++.dg/template/conv6.C b/gcc/testsuite/g++.dg/template/conv6.C new file mode 100644 index 000000000000..2a4a29952d55 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/conv6.C @@ -0,0 +1,24 @@ +// { dg-do compile } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Mar 2003 + +// PR 9898, DR 322. Conversion to reference type. + +template struct Ref {}; +template struct Val {}; + +struct Wrapper +{ + template operator Ref & (); + template operator Val (); +}; + +void Foo (Wrapper l) +{ + static_cast &> (l); + static_cast const &> (l); + static_cast > (l); + static_cast const &> (l); + static_cast > (l); +}