]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: CTAD from initializer list [PR106366]
authorPatrick Palka <ppalka@redhat.com>
Fri, 22 Jul 2022 22:42:02 +0000 (18:42 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 22 Jul 2022 22:42:02 +0000 (18:42 -0400)
commitf77bbc8f86900b21abdec457b4153b30512e192d
tree2894fe9c38862a9bccea9c4c12b2e1c32d0b5dae
parentb585af38a12bd6b64dbbb8c645e8e2b83b7ba012
c++: CTAD from initializer list [PR106366]

During CTAD, we currently perform the first phase of overload resolution
from [over.match.list] only if the class template has a list constructor.
But according to [over.match.class.deduct]/4 it should be enough to just
have a guide that looks like a list constructor (which is a more general
criterion in light of user-defined guides).

PR c++/106366

gcc/cp/ChangeLog:

* pt.cc (do_class_deduction): Don't consider TYPE_HAS_LIST_CTOR
when setting try_list_ctor.  Reset args even when try_list_ctor
is true and there are no list candidates.  Call resolve_args on
the reset args.  Rename try_list_ctor to try_list_cand.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/class-deduction112.C: New test.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp1z/class-deduction112.C [new file with mode: 0644]