]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix template deduction for conversion operators with xobj parameters [PR113629]
authorNathaniel Shead <nathanieloshead@gmail.com>
Tue, 5 Mar 2024 13:43:22 +0000 (00:43 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Wed, 6 Mar 2024 09:48:38 +0000 (20:48 +1100)
commit49d83e963aa453600088380aebd507e172eb80ad
treec3e1eae3e6b1aa7ebfa45a6fe75b5269aed3280a
parent3a910114fdb2aa76495c4c748acf6b9c7fbecc89
c++: Fix template deduction for conversion operators with xobj parameters [PR113629]

Unification for conversion operators (DEDUCE_CONV) doesn't perform
transformations like handling forwarding references. This is correct in
general, but not for xobj parameters, which should be handled "normally"
for the purposes of deduction: [temp.deduct.conv] only applies to the
return type of the conversion function.

PR c++/113629

gcc/cp/ChangeLog:

* pt.cc (type_unification_real): Only use DEDUCE_CONV for the
return type of a conversion function.

gcc/testsuite/ChangeLog:

* g++.dg/cpp23/explicit-obj-conv-op.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp23/explicit-obj-conv-op.C [new file with mode: 0644]