c++: deduction guide using alias [PR99180]
authorJason Merrill <jason@redhat.com>
Fri, 9 Apr 2021 22:02:38 +0000 (18:02 -0400)
committerJason Merrill <jason@redhat.com>
Sat, 10 Apr 2021 04:06:55 +0000 (00:06 -0400)
commit1a19d334ce493ec2ce2daeac74beef63fd67e2bc
tree86eb0cba26a951cf3f65afb782d031b1b1a6e150
parente89055f90cff9fb6f565b9374e1ab74f805682fb
c++: deduction guide using alias [PR99180]

alias_ctad_tweaks was expecting that all deduction guides for the class
would be suitable for deduction from the alias definition; in this case, the
deduction guide uses 'true' and the alias B uses 'false', so deduction
fails.  But that's OK, we just don't use that deduction guide.  I also
noticed that we were giving up on deduction entirely if substitution failed
for some guide; we should only give up on that particular deduction guide.

We ought to give a better diagnostic about this case when deduction fails,
but that can wait.

gcc/cp/ChangeLog:

PR c++/99180
PR c++/93295
PR c++/93867
PR c++/99118
PR c++/96873
* pt.c (alias_ctad_tweaks): Handle failure better.

gcc/testsuite/ChangeLog:

PR c++/99180
PR c++/93295
PR c++/93867
PR c++/95486
* g++.dg/cpp2a/class-deduction-alias5.C: New test.
* g++.dg/cpp2a/class-deduction-alias6.C: New test.
* g++.dg/cpp2a/class-deduction-alias7.C: New test.
* g++.dg/cpp2a/class-deduction-alias8.C: New test.
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/class-deduction-alias8.C [new file with mode: 0644]