]> gcc.gnu.org Git - gcc.git/commit
c++: alias CTAD and copy deduction guide [PR115198]
authorPatrick Palka <ppalka@redhat.com>
Tue, 25 Jun 2024 16:59:24 +0000 (12:59 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 28 Jun 2024 19:43:52 +0000 (15:43 -0400)
commita00a8d46ea6ff7130e2493e7bd9824e28e2509b7
tree40624cb613ea9e8ae18f2980fcd235ff767e188c
parent33a9c4dd5fcac7e3f5d835b35fe787126339dd2b
c++: alias CTAD and copy deduction guide [PR115198]

Here we're neglecting to update DECL_NAME during the alias CTAD guide
transformation, which causes copy_guide_p to return false for the
transformed copy deduction guide since DECL_NAME is still __dguide_C
with TREE_TYPE C<B, T> but it should be __dguide_A with TREE_TYPE A<T>
(i.e. C<false, T>).  This ultimately results in ambiguity during
overload resolution between the copy deduction guide vs copy ctor guide.

This patch makes us update DECL_NAME of a transformed guide accordingly
during alias/inherited CTAD.

PR c++/115198

gcc/cp/ChangeLog:

* pt.cc (alias_ctad_tweaks): Update DECL_NAME of the transformed
guides.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/class-deduction-alias22.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 06ebb7c6f31fe42ffdea6f51ac1ba1f6b058c090)
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias22.C [new file with mode: 0644]
This page took 0.071918 seconds and 6 git commands to generate.