[Bug c++/96199] [10/11 Regression] internal compiler error: in tsubst_copy with CTAD for alias templates

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 18 20:22:08 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96199

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:7fc49a5777943aab11e227136d00a836f28f12b2

commit r10-8639-g7fc49a5777943aab11e227136d00a836f28f12b2
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Aug 6 02:40:10 2020 -0400

    c++: Handle enumerator in C++20 alias CTAD. [PR96199]

    To form a deduction guide for an alias template, we substitute the template
    arguments from the pattern into the deduction guide for the underlying
    class.  In the case of B(A1<X>), that produces B(A1<B<T,1>::X>) -> B<T,1>.
    But since an enumerator doesn't have its own template info, and B<T,1> is a
    dependent scope, trying to look up B<T,1>::X fails and we crash.  So we
need
    to produce a SCOPE_REF instead.

    And trying to use the members of the template class is wrong for other
    members, as well, as it gives a nonsensical result if the class is
    specialized.

    gcc/cp/ChangeLog:

            PR c++/96199
            * pt.c (maybe_dependent_member_ref): New.
            (tsubst_copy) [CONST_DECL]: Use it.
            [VAR_DECL]: Likewise.
            (tsubst_aggr_type): Handle nested type.

    gcc/testsuite/ChangeLog:

            PR c++/96199
            * g++.dg/cpp2a/class-deduction-alias4.C: New test.


More information about the Gcc-bugs mailing list