aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2023-06-10 12:42:17 -0400
committerNathan Sidwell <nathan@acm.org>2023-06-10 17:22:21 -0400
commit80f075b410125bddb31459428760645baba1a69f (patch)
treee8f442c7b7de95097b2c696082e01f5c25cdb38e /gcc/cp
parent30a8771c0f5ddcbc329408c3bbf4f100b01acca9 (diff)
downloadgcc-80f075b410125bddb31459428760645baba1a69f.zip
gcc-80f075b410125bddb31459428760645baba1a69f.tar.gz
gcc-80f075b410125bddb31459428760645baba1a69f.tar.bz2
c++: Adjust conversion deduction [PR61663][DR976]
Drop the return type's reference before doing cvqual and related decays. gcc/cp/ PR c++/61663 * pt.cc (maybe_adjust_types_for_deduction): Implement DR976. gcc/testsuite/ * g++.dg/template/pr61663.C: New.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 6b20c58..6a2cf2c 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -22725,10 +22725,16 @@ maybe_adjust_types_for_deduction (tree tparms,
break;
case DEDUCE_CONV:
+ /* [temp.deduct.conv] First remove a reference type on parm.
+ DRs 322 & 976 affected this. */
+ if (TYPE_REF_P (*parm))
+ *parm = TREE_TYPE (*parm);
+
/* Swap PARM and ARG throughout the remainder of this
function; the handling is precisely symmetric since PARM
will initialize ARG rather than vice versa. */
std::swap (parm, arg);
+
break;
case DEDUCE_EXACT:
@@ -22795,11 +22801,6 @@ maybe_adjust_types_for_deduction (tree tparms,
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 && TYPE_REF_P (*arg))
- *arg = TREE_TYPE (*arg);
-
return result;
}